Total Complexity | 12 |
Total Lines | 63 |
Duplicated Lines | 0 % |
Coverage | 86.21% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | class ArrayCache extends Common implements CacheInterface |
||
15 | 2 | { |
|
16 | 2 | private array $bucket = []; |
|
17 | |||
18 | public function get($key, $default = null) |
||
19 | 2 | { |
|
20 | $this->checkReservedCharacters($key); |
||
21 | if (! $this->has($key)) { |
||
22 | 5 | return $default; |
|
23 | } |
||
24 | 5 | ||
25 | 3 | return $this->bucket[$key][0]; |
|
26 | 1 | } |
|
27 | |||
28 | 3 | public function set($key, $value, $ttl = null): bool |
|
42 | } |
||
43 | |||
44 | public function delete($key): bool |
||
45 | 6 | { |
|
46 | $this->checkReservedCharacters($key); |
||
47 | 6 | if (array_key_exists($key, $this->bucket)) { |
|
48 | 6 | unset($this->bucket[$key]); |
|
49 | |||
50 | return true; |
||
51 | 3 | } |
|
52 | |||
53 | 3 | return false; |
|
54 | 3 | } |
|
55 | 1 | ||
56 | public function clear(): bool |
||
61 | 3 | } |
|
62 | |||
63 | public function has($key): bool |
||
79 |