| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | public static function fromArray(array $data): ObjectInterface |
||
| 31 | { |
||
| 32 | $instance = new static(); |
||
| 33 | |||
| 34 | foreach ($data as $key => $value) { |
||
| 35 | $methodName = 'set' . str_replace(' ', '', ucwords(str_replace('_', ' ', $key))); |
||
| 36 | |||
| 37 | if (method_exists($instance, $methodName)) { |
||
| 38 | $instance->$methodName($value); |
||
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 | return $instance; |
||
| 43 | } |
||
| 59 |