| Conditions | 7 |
| Paths | 9 |
| Total Lines | 24 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | private static function prepareUnserializableData(array $data): array |
||
| 30 | { |
||
| 31 | foreach ($data as $key => $item) { |
||
| 32 | if (method_exists($item, 'getArrayCopy')) { |
||
| 33 | $data[$key] = self::prepareUnserializableData($item->getArrayCopy()); |
||
| 34 | } |
||
| 35 | |||
| 36 | if (method_exists($item, 'toDateTime')) { |
||
| 37 | $data[$key] = $item->toDateTime()->format('r'); |
||
| 38 | continue; |
||
| 39 | } |
||
| 40 | |||
| 41 | if (method_exists($item, '__toString')) { |
||
| 42 | $data[$key] = $item->__toString(); |
||
| 43 | continue; |
||
| 44 | } |
||
| 45 | |||
| 46 | if (is_array($item) || is_object($item)) { |
||
| 47 | $data[$key] = self::prepareUnserializableData((array)$item); |
||
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 51 | return $data; |
||
| 52 | } |
||
| 53 | |||
| 55 |