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