| Conditions | 6 |
| Paths | 7 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | 145 | public static function normalizeEta($eta) |
|
| 24 | { |
||
| 25 | 145 | if (null === $eta) { |
|
| 26 | 108 | return time(); |
|
| 27 | } |
||
| 28 | 44 | if (is_string($eta)) { |
|
| 29 | 16 | $eta = date_create($eta); |
|
| 30 | 16 | } |
|
| 31 | 44 | if ($eta instanceof \DateTime || $eta instanceof \DateTimeInterface) { |
|
| 32 | 17 | return $eta->getTimestamp(); |
|
| 33 | } |
||
| 34 | 27 | if (is_int($eta)) { |
|
| 35 | 24 | return $eta; |
|
| 36 | } |
||
| 37 | |||
| 38 | 3 | throw new \InvalidArgumentException('The eta parameter is not valid.'); |
|
| 39 | } |
||
| 40 | |||
| 57 |