Conditions | 6 |
Paths | 4 |
Total Lines | 25 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
Changes | 0 |
1 | <?php |
||
13 | public function hydrate(AnnotationInterface $annotation, array $json, ResourceInterface $object): array |
||
14 | { |
||
15 | if (!($annotation instanceof Collection)) { |
||
16 | return $json; |
||
17 | } |
||
18 | |||
19 | foreach ($annotation->properties() as $property) { |
||
20 | $array = $json[$property]; |
||
21 | |||
22 | if (!is_array($array)) { |
||
23 | continue; |
||
24 | } |
||
25 | |||
26 | $json[$property] = []; |
||
27 | foreach ($array as $resource) { |
||
28 | if ($resource === null) { |
||
29 | continue; |
||
30 | } |
||
31 | |||
32 | $json[$property][] = $this->getHydrator()->hydrate($annotation->get($property), $resource); |
||
33 | } |
||
34 | } |
||
35 | |||
36 | return $json; |
||
37 | } |
||
38 | |||
56 |