| Conditions | 6 |
| Paths | 6 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 6.0493 |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 100 | 21 | public function getTTL() |
|
| 101 | { |
||
| 102 | 21 | if (is_int($this->expires)) { |
|
| 103 | 3 | return floor($this->expires / 60.0); |
|
| 104 | } |
||
| 105 | |||
| 106 | 18 | if ($this->expires instanceof DateTimeInterface) { |
|
| 107 | 3 | $diff = (new DateTime())->diff($this->expires); |
|
| 108 | |||
| 109 | return boolval($diff->invert) ? 0 : $diff->i; |
||
| 110 | } |
||
| 111 | |||
| 112 | 15 | if ($this->expires instanceof DateInterval) { |
|
| 113 | 3 | return boolval($this->expires->invert) ? 0 : $this->expires->i; |
|
| 114 | } |
||
| 115 | 12 | } |
|
| 116 | } |
||
| 117 |