*/ final class NoopCommand implements CommandInterface { public function name(): string { return 'NOOP'; } public function allowedStates(): array { return [ SessionState::NotAuthenticated, SessionState::Authenticated, SessionState::Selected, ]; } public function encode(string $tag, SessionContext $context): RequestFrame { unset($tag, $context); return new RequestFrame('NOOP'); } public function handle(ResponseStream $responses, SessionContext $context): CommandStatusResult { unset($context); foreach ($responses as $response) { if ($response instanceof TaggedResponse) { if (!$response->isOk()) { throw new ImapException('NOOP failed: ' . $response->text()); } return new CommandStatusResult($response->status(), $response->text()); } } throw new ImapException('NOOP did not receive a tagged completion response.'); } }