| Conditions | 5 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| 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)); |
|
| 17 | |||
| 18 | 7 | if ( ! $contents) { |
|
| 19 | 3 | return null; |
|
| 20 | } |
||
| 21 | |||
| 22 | 6 | if ($withExpired) { |
|
| 23 | 1 | return $contents ?: null; |
|
| 24 | } |
||
| 25 | |||
| 26 | 6 | $isExpired = Carbon::parse($contents['expires_at'])->lt(Carbon::now()); |
|
| 27 | |||
| 28 | 6 | return $isExpired ? null : $contents; |
|
| 29 | } |
||
| 82 |