Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
9 / 9 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| CacheEntry | |
100.00% |
9 / 9 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toArray | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| fromArray | |
100.00% |
4 / 4 |
|
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\Internal; |
| 11 | |
| 12 | final readonly class CacheEntry |
| 13 | { |
| 14 | public function __construct( |
| 15 | public mixed $value, |
| 16 | public ?int $expiresAt, |
| 17 | ) {} |
| 18 | |
| 19 | public function toArray(): array |
| 20 | { |
| 21 | return [ |
| 22 | 'value' => $this->value, |
| 23 | 'expiresAt' => $this->expiresAt, |
| 24 | ]; |
| 25 | } |
| 26 | |
| 27 | public static function fromArray(array $data): self |
| 28 | { |
| 29 | return new self( |
| 30 | value: $data['value'], |
| 31 | expiresAt: $data['expiresAt'], |
| 32 | ); |
| 33 | } |
| 34 | } |