| Conditions | 5 |
| Paths | 7 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | public function initializeParameters($parameters = []) |
||
| 20 | { |
||
| 21 | if (!is_array($parameters)) { |
||
| 22 | throw new ArrayParametersExpectedException(); |
||
| 23 | } |
||
| 24 | |||
| 25 | if (empty($parameters)) { |
||
| 26 | $this->initializeParameters($this->setDefaults()); |
||
| 27 | } |
||
| 28 | |||
| 29 | foreach ($parameters as $parameter=>$value) { |
||
| 30 | $paramSetter = 'set'.ucfirst(strtolower($parameter)); |
||
| 31 | if (method_exists($this, $paramSetter)) { |
||
| 32 | $this->$paramSetter($value); |
||
| 33 | } else { |
||
| 34 | throw new OptionNotSupportedException(); |
||
| 35 | } |
||
| 36 | } |
||
| 37 | } |
||
| 38 | |||
| 41 |