Total Complexity | 8 |
Total Lines | 55 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
10 | final class TestPsrSimpleCache implements CacheInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var array<string, array{mixed, int|DateInterval|null}> |
||
|
|||
14 | */ |
||
15 | public array $data = []; |
||
16 | |||
17 | public function get(string $key, mixed $default = null): mixed |
||
18 | { |
||
19 | return $this->data[$key][0] ?? null; |
||
20 | } |
||
21 | |||
22 | public function set(string $key, mixed $value, DateInterval|int|null $ttl = null): bool |
||
23 | { |
||
24 | $this->data[$key] = [$value, $ttl]; |
||
25 | |||
26 | return true; |
||
27 | } |
||
28 | |||
29 | public function delete(string $key): bool |
||
30 | { |
||
31 | // n/a |
||
32 | return true; |
||
33 | } |
||
34 | |||
35 | public function clear(): bool |
||
36 | { |
||
37 | // n/a |
||
38 | return true; |
||
39 | } |
||
40 | |||
41 | public function getMultiple(iterable $keys, mixed $default = null): iterable |
||
42 | { |
||
43 | // n/a |
||
44 | return []; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @param iterable<mixed> $values |
||
49 | */ |
||
50 | public function setMultiple(iterable $values, DateInterval|int|null $ttl = null): bool |
||
51 | { |
||
52 | // n/a |
||
53 | return true; |
||
54 | } |
||
55 | |||
56 | public function deleteMultiple(iterable $keys): bool |
||
57 | { |
||
58 | // n/a |
||
59 | return true; |
||
60 | } |
||
61 | |||
62 | public function has(string $key): bool |
||
65 | } |
||
66 | } |
||
67 |