Conditions | 6 |
Paths | 7 |
Total Lines | 11 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 6 |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
53 | 5 | private function generateMappings(object $object): Generator |
|
54 | { |
||
55 | 5 | foreach ($this->config as $key => $value) { |
|
56 | 5 | $k = $value === true ? $key : $value; |
|
57 | 5 | $hasProperty = property_exists($object, $k); |
|
58 | 5 | $hasMethod = method_exists($object, $k); |
|
59 | 5 | if ($hasProperty || $hasMethod) { |
|
60 | 5 | $hydrationKey = new HydrationKey($key); |
|
61 | 5 | yield $key => $hasProperty |
|
62 | 5 | ? new PropertyMapping(new ReflectionProperty($object, $k), $hydrationKey) |
|
63 | 4 | : new MethodMapping(new ReflectionMethod($object, $value), $hydrationKey); |
|
64 | } |
||
68 |