InvalidCacheId.php 740 B

12345678910111213141516171819202122232425
  1. <?php
  2. declare(strict_types=1);
  3. namespace Doctrine\Common\Cache;
  4. use InvalidArgumentException;
  5. use function sprintf;
  6. final class InvalidCacheId extends InvalidArgumentException
  7. {
  8. public static function exceedsMaxLength($id, int $maxLength) : self
  9. {
  10. return new self(sprintf('Cache id "%s" exceeds maximum length %d', $id, $maxLength));
  11. }
  12. public static function containsUnauthorizedCharacter($id, string $character) : self
  13. {
  14. return new self(sprintf('Cache id "%s" contains unauthorized character "%s"', $id, $character));
  15. }
  16. public static function containsControlCharacter($id) : self
  17. {
  18. return new self(sprintf('Cache id "%s" contains at least one control character', $id));
  19. }
  20. }