Total Complexity | 8 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | trait MultipleTrait |
||
13 | { |
||
14 | abstract public function get(string $key, mixed $default); |
||
15 | abstract public function set(string $key, mixed $value, DateInterval|int|null $ttl = null); |
||
16 | abstract public function delete(string $key); |
||
17 | abstract protected function keys(iterable $keys); |
||
18 | abstract protected function values(iterable $values); |
||
19 | |||
20 | /** |
||
21 | 10 | * @inheritDoc |
|
22 | */ |
||
23 | 10 | public function getMultiple(iterable $keys, mixed $default = null) : iterable |
|
24 | 10 | { |
|
25 | 6 | $values = []; |
|
26 | foreach ($this->keys($keys) as $key) { |
||
27 | $values[$key] = $this->get($key, $default); |
||
28 | 6 | } |
|
29 | |||
30 | return $values; |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | 8 | * @inheritDoc |
|
35 | */ |
||
36 | 8 | public function setMultiple(iterable $values, DateInterval|int|null $ttl = null) : bool |
|
43 | } |
||
44 | |||
45 | /** |
||
46 | 5 | * @inheritDoc |
|
47 | */ |
||
48 | 5 | public function deleteMultiple($keys) : bool |
|
57 |