Total Complexity | 3 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
9 | class DateFormatterBasic implements DateFormatterInterface |
||
10 | { |
||
11 | /** |
||
12 | * @var DotnetDateTime |
||
13 | */ |
||
14 | private $dotnetDateTime; |
||
15 | |||
16 | /** |
||
17 | * @param DotnetDateTime $dotnetDateTime |
||
18 | */ |
||
19 | 4 | public function __construct(DotnetDateTime $dotnetDateTime) |
|
20 | { |
||
21 | 4 | $this->dotnetDateTime = $dotnetDateTime; |
|
22 | 4 | } |
|
23 | |||
24 | /** |
||
25 | * @param DateTimeInterface $date |
||
26 | * @param string $format |
||
27 | * @return string |
||
28 | */ |
||
29 | 2 | public function format(DateTimeInterface $date, $format) |
|
30 | { |
||
31 | 2 | $phpFormat = $this->dotnetDateTime->formatToPhp($format); |
|
32 | 2 | return (string) $date->format($phpFormat); |
|
33 | } |
||
34 | |||
35 | /** |
||
36 | * @return DateFormatterInterface |
||
37 | */ |
||
38 | 2 | public static function factory() |
|
42 | ); |
||
43 | } |
||
44 | } |
||
45 |