Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
11 / 11 |
|
100.00% |
8 / 8 |
CRAP | |
100.00% |
1 / 1 |
| NullCache | |
100.00% |
11 / 11 |
|
100.00% |
8 / 8 |
9 | |
100.00% |
1 / 1 |
| get | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| set | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| has | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| delete | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| clear | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getMultiple | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 | |||
| setMultiple | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| deleteMultiple | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 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\Adapter; |
| 11 | |
| 12 | use DateInterval; |
| 13 | use Override; |
| 14 | use Phexium\Plugin\Cache\Port\CacheInterface; |
| 15 | |
| 16 | final readonly class NullCache implements CacheInterface |
| 17 | { |
| 18 | #[Override] |
| 19 | public function get(string $key, mixed $default = null): mixed |
| 20 | { |
| 21 | return $default; |
| 22 | } |
| 23 | |
| 24 | #[Override] |
| 25 | public function set(string $key, mixed $value, DateInterval|int|null $ttl = null): bool |
| 26 | { |
| 27 | return true; |
| 28 | } |
| 29 | |
| 30 | #[Override] |
| 31 | public function has(string $key): bool |
| 32 | { |
| 33 | return false; |
| 34 | } |
| 35 | |
| 36 | #[Override] |
| 37 | public function delete(string $key): bool |
| 38 | { |
| 39 | return false; |
| 40 | } |
| 41 | |
| 42 | #[Override] |
| 43 | public function clear(): bool |
| 44 | { |
| 45 | return true; |
| 46 | } |
| 47 | |
| 48 | #[Override] |
| 49 | public function getMultiple(iterable $keys, mixed $default = null): iterable |
| 50 | { |
| 51 | $result = []; |
| 52 | |
| 53 | foreach ($keys as $key) { |
| 54 | $result[$key] = $default; |
| 55 | } |
| 56 | |
| 57 | return $result; |
| 58 | } |
| 59 | |
| 60 | #[Override] |
| 61 | public function setMultiple(iterable $values, DateInterval|int|null $ttl = null): bool |
| 62 | { |
| 63 | return true; |
| 64 | } |
| 65 | |
| 66 | #[Override] |
| 67 | public function deleteMultiple(iterable $keys): bool |
| 68 | { |
| 69 | return true; |
| 70 | } |
| 71 | } |