Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4.0218 |
Changes | 0 |
1 | <?php |
||
39 | 2 | public function extract(AnnotationInterface $annotation, ResourceInterface $object, array $json): array |
|
40 | { |
||
41 | 2 | if (!($annotation instanceof Collection)) { |
|
42 | return $json; |
||
43 | } |
||
44 | |||
45 | 2 | foreach ($annotation->properties() as $property) { |
|
46 | 2 | $array = $json[$property]; |
|
47 | 2 | $json[$property] = []; |
|
48 | 2 | foreach ($array as $resource) { |
|
49 | 2 | $json[$property][] = $this->getHydrator()->extract($annotation->get($property), $resource); |
|
50 | } |
||
51 | } |
||
52 | |||
53 | 2 | return $json; |
|
54 | } |
||
55 | } |
||
56 |