Conditions | 5 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | public function get(string $key, bool $withExpired = false) |
||
14 | { |
||
15 | $contents = apcu_fetch($this->getActualCacheKey($key)); |
||
16 | |||
17 | if ( ! $contents) { |
||
18 | return null; |
||
19 | } |
||
20 | |||
21 | if ($withExpired) { |
||
22 | return $contents ?: null; |
||
23 | } |
||
24 | |||
25 | $isExpired = Carbon::parse($contents['expires_at'])->lt(Carbon::now()); |
||
26 | |||
27 | return $isExpired ? null : $contents; |
||
28 | } |
||
82 |