File: InvalidCacheId.php

package info (click to toggle)
php-matomo-doctrine-cache 1.10.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 996 kB
  • sloc: php: 3,638; makefile: 17; sh: 9
file content (25 lines) | stat: -rw-r--r-- 740 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
declare(strict_types=1);

namespace Doctrine\Common\Cache;

use InvalidArgumentException;
use function sprintf;

final class InvalidCacheId extends InvalidArgumentException
{
    public static function exceedsMaxLength($id, int $maxLength) : self
    {
        return new self(sprintf('Cache id "%s" exceeds maximum length %d', $id, $maxLength));
    }

    public static function containsUnauthorizedCharacter($id, string $character) : self
    {
        return new self(sprintf('Cache id "%s" contains unauthorized character "%s"', $id, $character));
    }

    public static function containsControlCharacter($id) : self
    {
        return new self(sprintf('Cache id "%s" contains at least one control character', $id));
    }
}