Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
WithUtilsCache | |
0.00% |
0 / 5 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
getAll | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setAll | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
get | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
set | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
reset | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace Olz\Utils; |
4 | |
5 | class WithUtilsCache { |
6 | /** @var array<string, mixed> */ |
7 | private static array $utilsCache = []; |
8 | |
9 | /** @return array<string, mixed> */ |
10 | public static function getAll(): array { |
11 | return [...self::$utilsCache]; |
12 | } |
13 | |
14 | /** @param array<string, mixed> $utils */ |
15 | public static function setAll(array $utils): void { |
16 | self::$utilsCache = $utils; |
17 | } |
18 | |
19 | public static function get(string $name): mixed { |
20 | return self::$utilsCache[$name] ?? null; |
21 | } |
22 | |
23 | public static function set(string $name, mixed $util): void { |
24 | self::$utilsCache[$name] = $util; |
25 | } |
26 | |
27 | public static function reset(): void { |
28 | self::$utilsCache = []; |
29 | } |
30 | } |