InvalidCacheId.php 970 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. declare(strict_types=1);
  3. namespace Doctrine\Common\Cache;
  4. use InvalidArgumentException;
  5. use function sprintf;
  6. /**
  7. * @deprecated Deprecated without replacement in doctrine/cache 1.11. This class will be dropped in 2.0
  8. */
  9. final class InvalidCacheId extends InvalidArgumentException
  10. {
  11. /**
  12. * @param mixed $id
  13. */
  14. public static function exceedsMaxLength($id, int $maxLength): self
  15. {
  16. return new self(sprintf('Cache id "%s" exceeds maximum length %d', $id, $maxLength));
  17. }
  18. /**
  19. * @param mixed $id
  20. */
  21. public static function containsUnauthorizedCharacter($id, string $character): self
  22. {
  23. return new self(sprintf('Cache id "%s" contains unauthorized character "%s"', $id, $character));
  24. }
  25. /**
  26. * @param mixed $id
  27. */
  28. public static function containsControlCharacter($id): self
  29. {
  30. return new self(sprintf('Cache id "%s" contains at least one control character', $id));
  31. }
  32. }