| Conditions | 4 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public function initFromArray(array $data) |
||
| 22 | { |
||
| 23 | foreach ($data as $name => $value) { |
||
| 24 | $method = 'set' . ucfirst($name); |
||
| 25 | if (method_exists($this, $method)) { |
||
| 26 | call_user_func_array([$this, $method], [$value]); |
||
| 27 | } else { |
||
| 28 | if (property_exists(get_called_class(), $name)) { |
||
| 29 | $this->$name = $value; |
||
| 30 | } |
||
| 31 | } |
||
| 32 | } |
||
| 33 | } |
||
| 34 | |||
| 63 | } |