generated from Nodarx/template
refactor: unify quotes encoding
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace KTXM\ProviderImap\Client\Protocol\Command\Argument;
|
||||
|
||||
use KTXM\ProviderImap\Client\Protocol\StringEncoder;
|
||||
use KTXM\ProviderImap\Client\Protocol\SequenceSet;
|
||||
|
||||
use DateTimeInterface;
|
||||
@@ -190,8 +191,8 @@ final class SearchCriteriaBuilder
|
||||
{
|
||||
return $this->pushExpression(sprintf(
|
||||
'HEADER %s %s',
|
||||
$this->formatString($name),
|
||||
$this->formatString($value),
|
||||
StringEncoder::quote($name),
|
||||
StringEncoder::quote($value),
|
||||
));
|
||||
}
|
||||
|
||||
@@ -287,7 +288,7 @@ final class SearchCriteriaBuilder
|
||||
return $this->pushExpression(sprintf(
|
||||
'%s %s',
|
||||
$key,
|
||||
$quote ? $this->formatString($value) : $value,
|
||||
$quote ? StringEncoder::quote($value) : $value,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -371,9 +372,4 @@ final class SearchCriteriaBuilder
|
||||
default => SequenceSet::parse($value)->toCommand(),
|
||||
};
|
||||
}
|
||||
|
||||
private function formatString(string $value): string
|
||||
{
|
||||
return '"' . addcslashes($value, "\\\"") . '"';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user