Conditions | 4 |
Paths | 4 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 4.0092 |
Changes | 0 |
1 | <?php |
||
24 | 4 | private static function extract($object): array |
|
25 | { |
||
26 | 4 | if (is_iterable($object)) { |
|
27 | 2 | $result = []; |
|
28 | 2 | foreach ($object as $key => $value) { |
|
29 | 2 | if (is_object($value)) { |
|
30 | $result[$key] = self::extract($object); |
||
31 | } else { |
||
32 | 2 | $result[$key] = $value; |
|
33 | } |
||
34 | } |
||
35 | 2 | return $result; |
|
36 | } else { |
||
37 | 2 | $config = new \GeneratedHydrator\Configuration(get_class($object)); |
|
38 | 2 | $hydratorClass = $config->createFactory()->getHydratorClass(); |
|
39 | /** @var HydratorInterface $hydrator */ |
||
40 | 2 | $hydrator = new $hydratorClass(); |
|
41 | 2 | return $hydrator->extract($object); |
|
42 | } |
||
43 | } |
||
44 | } |
||
45 |