| Conditions | 3 |
| Paths | 3 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | public function __set($key, $value) |
||
| 16 | { |
||
| 17 | // Convert electronic_collections to ElectronicCollections |
||
| 18 | $key_s = implode('', array_map(function ($x) { |
||
| 19 | return ucfirst($x); |
||
| 20 | }, explode('_', $key))); |
||
| 21 | |||
| 22 | // If there's a setter method, call it. |
||
| 23 | $method = 'set' . ucfirst($key_s); |
||
| 24 | if (method_exists($this, $method)) { |
||
| 25 | return $this->$method($value); |
||
| 26 | } |
||
| 27 | $method = 'set' . ucfirst($key); |
||
| 28 | if (method_exists($this, $method)) { |
||
| 29 | return $this->$method($value); |
||
| 30 | } |
||
| 31 | |||
| 32 | // Otherwise set the key on the data object |
||
| 33 | $this->data->{$key} = $value; |
||
| 34 | } |
||
| 35 | } |
||
| 36 |