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