Conditions | 6 |
Paths | 4 |
Total Lines | 20 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
15 | 1 | public static function stdClassToArray(\stdClass $object) |
|
16 | { |
||
17 | 1 | $object = (array) $object; |
|
18 | 1 | foreach ($object as &$value) { |
|
19 | 1 | if ($value instanceof \stdClass) { |
|
20 | 1 | $value = self::stdClassToArray($value); |
|
21 | 1 | continue; |
|
22 | } |
||
23 | 1 | if (is_array($value)) { |
|
24 | 1 | foreach ($value as &$arrayValue) { |
|
25 | 1 | if ($arrayValue instanceof \stdClass) { |
|
26 | 1 | $arrayValue = self::stdClassToArray($arrayValue); |
|
27 | 1 | continue; |
|
28 | } |
||
29 | 1 | } |
|
30 | 1 | } |
|
31 | 1 | } |
|
32 | |||
33 | 1 | return $object; |
|
34 | } |
||
35 | } |
||
36 |