| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 24 | public function denormalize($className, array $data = []) |
||
| 25 | { |
||
| 26 | $reflectionClass = new \ReflectionClass($className); |
||
| 27 | $instance = $reflectionClass->newInstanceWithoutConstructor(); |
||
| 28 | foreach ($reflectionClass->getProperties() as $reflectionProperty) { |
||
| 29 | $propertyName = $reflectionProperty->getName(); |
||
| 30 | $type = $this->detectType($reflectionProperty); |
||
| 31 | |||
| 32 | $instance->{$propertyName} = class_exists($type) |
||
| 33 | ? $this->denormalize($type, $data[$propertyName]) |
||
| 34 | : $data[$propertyName] |
||
| 35 | ; |
||
| 36 | } |
||
| 37 | |||
| 38 | return $instance; |
||
| 39 | } |
||
| 40 | |||
| 60 |