| Total Complexity | 8 |
| Total Lines | 68 |
| Duplicated Lines | 0 % |
| Coverage | 94.44% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class DateFormatter implements Formatter |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | public string $date_format = 'Y-m-d'; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var mixed |
||
| 21 | */ |
||
| 22 | public mixed $instance; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var mixed |
||
| 26 | */ |
||
| 27 | public mixed $timezone; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Format the date. |
||
| 31 | * |
||
| 32 | * @param Collection $items |
||
| 33 | * |
||
| 34 | * @return string |
||
| 35 | */ |
||
| 36 | 7 | public function format(Collection $items): string |
|
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @param Collection $items |
||
| 57 | * |
||
| 58 | * @return void |
||
| 59 | */ |
||
| 60 | 7 | protected function getInstance(Collection $items): void |
|
| 61 | { |
||
| 62 | 7 | $this->instance = $items->first(); |
|
| 63 | |||
| 64 | 7 | if (is_array($this->instance)) { |
|
| 65 | $this->instance = current($this->instance); |
||
| 66 | } |
||
| 67 | } |
||
| 68 | |||
| 69 | /** |
||
| 70 | * @param Collection $items |
||
| 71 | * |
||
| 72 | * @return void |
||
| 73 | */ |
||
| 74 | 7 | protected function getTimezone(Collection $items): void |
|
| 80 | } |
||
| 81 | } |
||
| 83 |