Conditions | 8 |
Paths | 15 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 8 |
Changes | 0 |
1 | <?php |
||
36 | protected function parseObjects(array|object $data): array |
||
37 | { |
||
38 | 1 | if ($data instanceof Traversable) { |
|
|
|||
39 | 1 | $data = iterator_to_array($data); |
|
40 | 1 | } elseif ($data instanceof stdClass) { |
|
41 | 1 | $data = (array) $data; |
|
42 | } |
||
43 | |||
44 | 1 | foreach ($data as $key => $value) { |
|
45 | 1 | if ($value instanceof IResource) { |
|
46 | 1 | $value = $value->getData(); |
|
47 | } |
||
48 | |||
49 | 1 | if ($value instanceof Traversable || $value instanceof stdClass || is_array($value)) { |
|
50 | 1 | $data[$key] = $this->parseObjects($value); |
|
51 | } |
||
52 | } |
||
53 | 1 | return $data; |
|
54 | } |
||
56 |