Total Complexity | 6 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
10 | final class CacheCollection implements Cache |
||
11 | { |
||
12 | /** |
||
13 | * @param Cache[] $collection |
||
14 | */ |
||
15 | public function __construct( |
||
16 | private readonly array $collection |
||
17 | ) { |
||
18 | } |
||
19 | |||
20 | public function get(string $path): ?array |
||
21 | { |
||
22 | foreach ($this->collection as $cache) { |
||
23 | $data = $cache->get($path); |
||
24 | |||
25 | if ($data !== null) { |
||
26 | return $data; |
||
27 | } |
||
28 | } |
||
29 | |||
30 | return null; |
||
31 | } |
||
32 | |||
33 | public function set(string $path, array $data): void |
||
37 | } |
||
38 | } |
||
39 | } |
||
40 |