Conditions | 4 |
Paths | 4 |
Total Lines | 12 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
33 | 4 | public function hydrate(\stdClass $instance): Serializable |
|
34 | { |
||
35 | 4 | foreach ($instance as $key => $value) { |
|
36 | 4 | $setter = self::_SETTER_PREFIX . ucfirst($key); |
|
37 | 4 | $callee = [$this, $setter]; |
|
38 | 4 | if (is_callable($callee)) { |
|
39 | 4 | $className = self::_ENTITY_NS_PREFIX . ucfirst($key); |
|
40 | 4 | $arg = (is_object($value)) ? (new $className())->hydrate($value) : $value; |
|
41 | 4 | call_user_func_array($callee, [$arg]); |
|
42 | } |
||
43 | } |
||
44 | 4 | return $this; |
|
45 | } |
||
47 |