refactor: unify command complition checking

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-09-25 12:14:37 -04:00
parent 1b68c99521
commit 6a36e91cb4
21 changed files with 132 additions and 80 deletions
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace KTXM\ProviderImap\Client\Protocol\Command;
use KTXM\ProviderImap\Client\Protocol\CompletionChecker;
use KTXM\ProviderImap\Client\Result\CommandCompletion;
use KTXM\ProviderImap\Client\ImapException;
use KTXM\ProviderImap\Client\Protocol\RequestFrame;
@@ -42,9 +43,7 @@ final class LogoutCommand implements CommandInterface
{
foreach ($responses as $response) {
if ($response instanceof TaggedResponse) {
if (!$response->isOk()) {
throw new ImapException('LOGOUT failed: ' . $response->text());
}
CompletionChecker::assertSuccess($this->name(), $response);
$context->setSelectedMailbox(null);
$context->setState(SessionState::Logout);