| Conditions | 4 |
| Paths | 4 |
| Total Lines | 12 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | 8 | public function getDateTime($date) |
|
| 20 | { |
||
| 21 | 8 | if ($date instanceof \DateTimeInterface) { |
|
| 22 | 4 | $date = new \DateTime($date->format(\DateTime::ISO8601)); |
|
| 23 | 8 | } elseif (is_numeric($date)) { // is UTS |
|
| 24 | 2 | $date = (new \DateTime())->setTimestamp($date); |
|
| 25 | 4 | } elseif (!($date instanceof \DateTime)) { |
|
| 26 | 2 | $date = new \DateTime($date); |
|
| 27 | 2 | } |
|
| 28 | |||
| 29 | 8 | return $date; |
|
| 30 | } |
||
| 31 | } |
||
| 32 |