Total Complexity | 7 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | final class CacheKeyNormalizer |
||
21 | { |
||
22 | /** |
||
23 | * Normalizes the cache key from a given key. |
||
24 | * |
||
25 | * If the given key is a string that does not contain characters `{}()/\@:` and no more than 64 characters, |
||
26 | * then the key will be returned back as it is, integers will be converted to strings. Otherwise, |
||
27 | * a normalized key is generated by serializing the given key and applying MD5 hashing. |
||
28 | * |
||
29 | * @see https://www.php-fig.org/psr/psr-16/#12-definitions |
||
30 | * |
||
31 | * @param mixed $key The key to be normalized. |
||
32 | * |
||
33 | * @throws InvalidArgumentException For invalid key. |
||
34 | * |
||
35 | * @return string The normalized cache key. |
||
36 | */ |
||
37 | 62 | public function normalize($key): string |
|
52 |