| Total Complexity | 8 |
| Total Lines | 59 |
| Duplicated Lines | 0 % |
| Coverage | 75% |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | final class InMemoryCache implements CacheInterface |
||
| 8 | { |
||
| 9 | /** @var array<string, array<string,string>> */ |
||
| 10 | private static array $cache = []; |
||
| 11 | |||
| 12 | 53 | public function __construct( |
|
| 15 | 53 | } |
|
| 16 | |||
| 17 | /** |
||
| 18 | * @internal |
||
| 19 | * |
||
| 20 | 2 | * @return array<string, string> |
|
| 21 | */ |
||
| 22 | 2 | public static function getAllFromKey(string $key): array |
|
| 23 | { |
||
| 24 | return self::$cache[$key] ?? []; |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @internal |
||
| 29 | * |
||
| 30 | * @return array<string, array<string,string>> |
||
| 31 | */ |
||
| 32 | public static function all(): array |
||
| 33 | { |
||
| 34 | return self::$cache; |
||
| 35 | } |
||
| 36 | 58 | ||
| 37 | /** |
||
| 38 | 58 | * @internal |
|
| 39 | */ |
||
| 40 | public static function resetCache(): void |
||
| 41 | { |
||
| 42 | self::$cache = []; |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @return array<string, string> |
||
| 47 | */ |
||
| 48 | public function getAll(): array |
||
| 49 | 74 | { |
|
| 50 | return self::$cache[$this->key] ?? []; |
||
| 51 | 74 | } |
|
| 52 | |||
| 53 | public function has(string $cacheKey): bool |
||
| 56 | 29 | } |
|
| 57 | |||
| 58 | public function get(string $cacheKey): string |
||
| 61 | 58 | } |
|
| 62 | |||
| 63 | public function put(string $cacheKey, string $className): void |
||
| 66 | } |
||
| 67 | } |
||
| 68 |