Conditions | 1 |
Paths | 1 |
Total Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php namespace Limoncello\Flute\Types; |
||
41 | 37 | public static function createFromDateTime(DateTimeInterface $dateTime): self |
|
42 | { |
||
43 | 37 | $utcTimestamp = $dateTime->getTimestamp(); |
|
44 | |||
45 | // yes, PHP DateTime can accept integer timestamp only as a string ¯\_( ͡° ͜ʖ ͡°)_/¯ |
||
46 | 37 | $result = (new self("@$utcTimestamp"))->setTimezone($dateTime->getTimezone()); |
|
47 | |||
48 | 37 | return $result; |
|
49 | } |
||
50 | |||
59 |