Total Complexity | 6 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | final class InMemoryFileCache implements ClassNameCacheInterface |
||
8 | { |
||
9 | /** @var array<string,array<string,string>> */ |
||
10 | private static array $cache = []; |
||
11 | |||
12 | private string $key; |
||
13 | |||
14 | public function __construct(string $key) |
||
15 | { |
||
16 | $this->key = $key; |
||
17 | } |
||
18 | |||
19 | /** |
||
20 | * @internal |
||
21 | */ |
||
22 | public static function getAll(string $key): array |
||
23 | { |
||
24 | return self::$cache[$key] ?? []; |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * @internal |
||
29 | */ |
||
30 | public static function resetCache(): void |
||
33 | } |
||
34 | |||
35 | public function has(string $cacheKey): bool |
||
36 | { |
||
37 | return isset(self::$cache[$this->key][$cacheKey]); |
||
38 | } |
||
39 | |||
40 | public function get(string $cacheKey): string |
||
41 | { |
||
42 | return self::$cache[$this->key][$cacheKey]; |
||
43 | } |
||
44 | |||
45 | public function put(string $cacheKey, string $className): void |
||
48 | } |
||
49 | } |
||
50 |