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