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