Conditions | 4 |
Paths | 4 |
Total Lines | 9 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | protected function hydrate(array $data = []): void |
||
30 | { |
||
31 | foreach ($data as $key => $value) { |
||
32 | $keyName = Str::camel($key, true); |
||
33 | $setterMethod = sprintf('set%s', ucfirst($keyName)); |
||
34 | if (method_exists($this, $setterMethod)) { |
||
35 | $this->{$setterMethod}($value); |
||
36 | } elseif (property_exists($this, $keyName)) { |
||
37 | $this->{$keyName} = $value; |
||
38 | } |
||
42 |