Conditions | 4 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 4 |
Changes | 2 | ||
Bugs | 0 | Features | 2 |
1 | <?php |
||
46 | 15 | private function getExpireTime($expiresAt) |
|
47 | { |
||
48 | 15 | if ($expiresAt instanceof \DateTime) { |
|
49 | 3 | return $expiresAt; |
|
50 | } |
||
51 | |||
52 | 12 | $date = new \DateTime(); |
|
53 | |||
54 | 12 | if ($expiresAt instanceof \DateInterval) { |
|
55 | 3 | $date->add($expiresAt); |
|
56 | 3 | return $date; |
|
57 | } |
||
58 | |||
59 | 9 | if (is_numeric($expiresAt)) { |
|
60 | 3 | $dateInterval = \DateInterval::createFromDateString(abs($expiresAt) . ' seconds'); |
|
61 | 3 | $date->add($dateInterval); |
|
62 | 3 | return $date; |
|
63 | } |
||
64 | |||
65 | 6 | return $date->add(new \DateInterval('P1D')); |
|
66 | } |
||
67 | } |
||
68 |