Conditions | 4 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4.0218 |
Changes | 0 |
1 | <?php |
||
13 | 6 | public function hydrate(AnnotationInterface $annotation, array $json, ResourceInterface $object): array |
|
14 | { |
||
15 | 6 | if (!($annotation instanceof Rename)) { |
|
16 | return $json; |
||
17 | } |
||
18 | |||
19 | 6 | foreach ($annotation->properties() as $property) { |
|
20 | 6 | if (!isset($json[$annotation->get($property)])) { |
|
21 | 2 | continue; |
|
22 | } |
||
23 | |||
24 | 4 | $json[$property] = $json[$annotation->get($property)]; |
|
25 | 4 | unset($json[$annotation->get($property)]); |
|
26 | } |
||
27 | |||
28 | 6 | return $json; |
|
29 | } |
||
30 | |||
45 |