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