| Conditions | 4 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 43 | 468 | public static function create($datepoint): DateTimeImmutable |
|
| 44 | { |
||
| 45 | 468 | if ($datepoint instanceof DateTimeImmutable) { |
|
| 46 | 336 | return $datepoint; |
|
| 47 | } |
||
| 48 | |||
| 49 | 357 | if ($datepoint instanceof DateTime) { |
|
| 50 | 174 | return self::createFromMutable($datepoint); |
|
| 51 | } |
||
| 52 | |||
| 53 | 195 | if (false !== ($timestamp = filter_var($datepoint, FILTER_VALIDATE_INT))) { |
|
| 54 | 3 | return new self('@'.$timestamp); |
|
| 55 | } |
||
| 56 | |||
| 57 | 192 | return new self($datepoint); |
|
| 58 | } |
||
| 60 |