Conditions | 3 |
Paths | 3 |
Total Lines | 10 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | 9 | protected function timeToInt($time): ?int |
|
24 | { |
||
25 | 9 | if (is_object($time)) { |
|
26 | 2 | if ($time instanceof DateInterval) { |
|
|
|||
27 | 1 | $now = new DateTime(); |
|
28 | 1 | return $now->add($time)->getTimestamp(); |
|
29 | } |
||
30 | 1 | throw new CacheException('Invalid object for time interval'); |
|
31 | } |
||
32 | 7 | return $time; |
|
33 | } |
||
35 |