| Conditions | 3 |
| Paths | 1 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3.009 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | public function hydrate(EntityInterface $entity, array $data) |
||
| 25 | { |
||
| 26 | 20 | $hydrator = function ($data) { |
|
| 27 | 20 | foreach ($data as $property => $value) { |
|
| 28 | 20 | if (!property_exists($this, $property)) { |
|
| 29 | continue; |
||
| 30 | } |
||
| 31 | 20 | $this->$property = $value; |
|
| 32 | 20 | } |
|
| 33 | 20 | }; |
|
| 34 | |||
| 35 | 20 | $hydrator = $hydrator->bindTo($entity, $entity); |
|
| 36 | 20 | $hydrator($data); |
|
| 37 | |||
| 38 | 20 | return $entity; |
|
| 39 | } |
||
| 41 |