2020-08-08 07:42:38 +09:00
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Doctrine\Common\Cache;
|
|
|
|
|
|
|
|
use InvalidArgumentException;
|
2021-07-18 20:40:01 +09:00
|
|
|
|
2020-08-08 07:42:38 +09:00
|
|
|
use function sprintf;
|
|
|
|
|
2021-07-18 20:40:01 +09:00
|
|
|
/**
|
|
|
|
* @deprecated Deprecated without replacement in doctrine/cache 1.11. This class will be dropped in 2.0
|
|
|
|
*/
|
2020-08-08 07:42:38 +09:00
|
|
|
final class InvalidCacheId extends InvalidArgumentException
|
|
|
|
{
|
2021-07-18 20:40:01 +09:00
|
|
|
/**
|
|
|
|
* @param mixed $id
|
|
|
|
*/
|
|
|
|
public static function exceedsMaxLength($id, int $maxLength): self
|
2020-08-08 07:42:38 +09:00
|
|
|
{
|
|
|
|
return new self(sprintf('Cache id "%s" exceeds maximum length %d', $id, $maxLength));
|
|
|
|
}
|
|
|
|
|
2021-07-18 20:40:01 +09:00
|
|
|
/**
|
|
|
|
* @param mixed $id
|
|
|
|
*/
|
|
|
|
public static function containsUnauthorizedCharacter($id, string $character): self
|
2020-08-08 07:42:38 +09:00
|
|
|
{
|
|
|
|
return new self(sprintf('Cache id "%s" contains unauthorized character "%s"', $id, $character));
|
|
|
|
}
|
|
|
|
|
2021-07-18 20:40:01 +09:00
|
|
|
/**
|
|
|
|
* @param mixed $id
|
|
|
|
*/
|
|
|
|
public static function containsControlCharacter($id): self
|
2020-08-08 07:42:38 +09:00
|
|
|
{
|
|
|
|
return new self(sprintf('Cache id "%s" contains at least one control character', $id));
|
|
|
|
}
|
|
|
|
}
|