| Conditions | 7 |
| Paths | 5 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 7.0957 |
| Changes | 0 | ||
| 1 | <?php |
||
| 44 | private function parseDateTimeToString(mixed $array): array|string |
||
| 45 | { |
||
| 46 | 1 | if (!is_array($array)) { |
|
| 47 | 1 | if ($array instanceof DateTime || interface_exists('DateTimeInterface') && $array instanceof DateTimeInterface) { |
|
| 48 | 1 | return $array->format($this->format); |
|
| 49 | } |
||
| 50 | return strval($array); |
||
| 51 | } |
||
| 52 | |||
| 53 | 1 | foreach ($array as $key => $value) { |
|
| 54 | 1 | if (is_iterable($array)) { |
|
| 55 | /** @var string|int|object $value */ |
||
| 56 | 1 | $array[$key] = $this->parseDateTimeToString($value); |
|
| 57 | } |
||
| 58 | } |
||
| 59 | 1 | return $array; |
|
| 60 | } |
||
| 62 |