| Total Complexity | 8 |
| Total Lines | 57 |
| 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 | private string $key; |
||
| 13 | |||
| 14 | 32 | public function __construct(string $key) |
|
| 15 | { |
||
| 16 | 32 | $this->key = $key; |
|
| 17 | } |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @internal |
||
| 21 | */ |
||
| 22 | 2 | public static function getAllFromKey(string $key): array |
|
| 23 | { |
||
| 24 | 2 | return self::$cache[$key] ?? []; |
|
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @internal |
||
| 29 | */ |
||
| 30 | public static function all(): array |
||
| 31 | { |
||
| 32 | return self::$cache; |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @internal |
||
| 37 | */ |
||
| 38 | 8 | public static function resetCache(): void |
|
| 39 | { |
||
| 40 | 8 | self::$cache = []; |
|
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @return array<string, string> |
||
| 45 | */ |
||
| 46 | public function getAll(): array |
||
| 47 | { |
||
| 48 | return self::$cache[$this->key] ?? []; |
||
| 49 | } |
||
| 50 | |||
| 51 | 32 | public function has(string $cacheKey): bool |
|
| 54 | } |
||
| 55 | |||
| 56 | 19 | public function get(string $cacheKey): string |
|
| 57 | { |
||
| 59 | } |
||
| 60 | |||
| 61 | 21 | public function put(string $cacheKey, string $className): void |
|
| 64 | } |
||
| 65 | } |
||
| 66 |