Total Complexity | 8 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
17 | class ItemAdapter implements CacheItemInterface |
||
18 | { |
||
19 | use TClock; |
||
20 | use TExpire; |
||
21 | |||
22 | /** @var mixed|null */ |
||
23 | protected $cache = null; |
||
24 | protected string $key = ''; |
||
25 | |||
26 | 10 | public function __construct(string $key, ClockInterface $clock = null) |
|
27 | { |
||
28 | 10 | $this->key = $key; |
|
29 | 10 | $this->initTClock($clock); |
|
30 | 10 | } |
|
31 | |||
32 | 8 | public function getKey() |
|
35 | } |
||
36 | |||
37 | 3 | public function get() |
|
38 | { |
||
39 | 3 | return $this->isHit() ? $this->cache : null; |
|
40 | } |
||
41 | |||
42 | 5 | public function isHit() |
|
45 | } |
||
46 | |||
47 | 3 | public function set($value) |
|
51 | } |
||
52 | |||
53 | 5 | protected function isExpired(): bool |
|
63 |