Conditions | 5 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types = 1); |
||
53 | private function fixHashMaps(&$data) |
||
54 | { |
||
55 | if (is_array($data)) { |
||
56 | $shouldBeObject = false; |
||
57 | $object = new \stdClass(); |
||
58 | $index = 0; |
||
59 | foreach ($data as $key => &$value) { |
||
60 | $object->$key = $this->fixHashMaps($value); |
||
61 | if ($index++ !== $key) { |
||
62 | $shouldBeObject = true; |
||
63 | } |
||
64 | } |
||
65 | if ($shouldBeObject) { |
||
66 | $data = $object; |
||
67 | } |
||
68 | } |
||
69 | |||
70 | return $data; |
||
71 | } |
||
72 | } |
||
73 |