refactor: unify quotes encoding

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-09-25 11:49:18 -04:00
parent cd724df8ec
commit 09d0bbd817
11 changed files with 38 additions and 63 deletions
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace KTXM\ProviderImap\Client\Protocol\Command;
use KTXM\ProviderImap\Client\Protocol\StringEncoder;
use KTXM\ProviderImap\Client\Result\CommandStatusResult;
use KTXM\ProviderImap\Client\ImapException;
use KTXM\ProviderImap\Client\Protocol\RequestFrame;
@@ -38,7 +39,7 @@ final class CreateCommand implements CommandInterface
{
unset($tag, $context);
return new RequestFrame(sprintf('CREATE %s', $this->quote($this->mailbox)));
return new RequestFrame(sprintf('CREATE %s', StringEncoder::quote($this->mailbox)));
}
public function handle(ResponseStream $responses, SessionContext $context): CommandStatusResult
@@ -57,9 +58,4 @@ final class CreateCommand implements CommandInterface
throw new ImapException('CREATE did not receive a tagged completion response.');
}
private function quote(string $value): string
{
return '"' . addcslashes($value, "\\\"") . '"';
}
}