Total Complexity | 2 |
Total Lines | 17 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | final class DotNetTimeConverter implements DotNetTimeConverterInterface |
||
17 | { |
||
18 | private const MULTIPLIER = 1e7; |
||
19 | |||
20 | private const OFFSET = 621355968e9; |
||
21 | |||
22 | 1 | public function toDatetime(string $ticks): DateTimeInterface |
|
23 | { |
||
24 | 1 | return DateTimeImmutable::createFromFormat( |
|
25 | 1 | 'U', |
|
26 | 1 | (string) ((int) (((float) $ticks - self::OFFSET) / self::MULTIPLIER)) |
|
27 | 1 | ); |
|
28 | } |
||
29 | |||
30 | 1 | public function toTicks(DateTimeInterface $datetime): string |
|
33 | } |
||
34 | } |
||
35 |