| Total Complexity | 6 |
| Total Lines | 21 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class DateTimeLocalTransformer implements TransformerInterface |
||
| 13 | { |
||
| 14 | public function __construct( |
||
| 15 | private string $dateFormat |
||
| 16 | ) {} |
||
| 17 | |||
| 18 | public function input(mixed $data): string |
||
| 19 | { |
||
| 20 | if ($data instanceof DateTimeInterface) { |
||
| 21 | return $data->format($this->dateFormat); |
||
| 22 | } |
||
| 23 | |||
| 24 | return $data !== null ? $data : ''; |
||
| 25 | } |
||
| 26 | |||
| 27 | public function output(string $value): ?DateTimeInterface |
||
| 33 | } |
||
| 34 | } |
||
| 35 |