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