Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
10 / 10 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| CacheMultipleOperationsTrait | |
100.00% |
10 / 10 |
|
100.00% |
3 / 3 |
6 | |
100.00% |
1 / 1 |
| getMultiple | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 | |||
| setMultiple | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |||
| deleteMultiple | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | // ╔════════════════════════════════════════════════════════════╗ |
| 4 | // ║ MIT Licence (#Expat) - https://opensource.org/licenses/MIT ║ |
| 5 | // ║ Copyright 2026 Frederic Poeydomenge <dyno@phexium.com> ║ |
| 6 | // ╚════════════════════════════════════════════════════════════╝ |
| 7 | |
| 8 | declare(strict_types=1); |
| 9 | |
| 10 | namespace Phexium\Plugin\Cache\Internal; |
| 11 | |
| 12 | use DateInterval; |
| 13 | use Override; |
| 14 | |
| 15 | trait CacheMultipleOperationsTrait |
| 16 | { |
| 17 | #[Override] |
| 18 | public function getMultiple(iterable $keys, mixed $default = null): iterable |
| 19 | { |
| 20 | $result = []; |
| 21 | |
| 22 | foreach ($keys as $key) { |
| 23 | $result[$key] = $this->get($key, $default); |
| 24 | } |
| 25 | |
| 26 | return $result; |
| 27 | } |
| 28 | |
| 29 | #[Override] |
| 30 | public function setMultiple(iterable $values, DateInterval|int|null $ttl = null): bool |
| 31 | { |
| 32 | foreach ($values as $key => $value) { |
| 33 | $this->set($key, $value, $ttl); |
| 34 | } |
| 35 | |
| 36 | return true; |
| 37 | } |
| 38 | |
| 39 | #[Override] |
| 40 | public function deleteMultiple(iterable $keys): bool |
| 41 | { |
| 42 | foreach ($keys as $key) { |
| 43 | $this->delete($key); |
| 44 | } |
| 45 | |
| 46 | return true; |
| 47 | } |
| 48 | } |