| @@ 37-49 (lines=13) @@ | ||
| 34 | * @throws Exception\InvalidSettingsException |
|
| 35 | * @return self |
|
| 36 | */ |
|
| 37 | public function __set($key, $value) |
|
| 38 | { |
|
| 39 | $method = 'set' . ucfirst($key); |
|
| 40 | ||
| 41 | if (method_exists($this, $method)) { |
|
| 42 | $this->$method($value); |
|
| 43 | } elseif (property_exists($this, $key)) { |
|
| 44 | throw new RealizationException("Property `$key` required realization setter method `$method`"); |
|
| 45 | } else { |
|
| 46 | throw new InvalidSettingsException("Configuration option `$key`` is undefined"); |
|
| 47 | } |
|
| 48 | return $this; |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * __get |
|
| @@ 59-70 (lines=12) @@ | ||
| 56 | * @throws Exception\InvalidSettingsException |
|
| 57 | * @return self |
|
| 58 | */ |
|
| 59 | public function __get($key) |
|
| 60 | { |
|
| 61 | $method = 'get' . ucfirst($key); |
|
| 62 | ||
| 63 | if (method_exists($this, $method)) { |
|
| 64 | return $this->$method($key); |
|
| 65 | } elseif (property_exists($this, $key)) { |
|
| 66 | throw new RealizationException("Property `$key` required realization getter method `$method`"); |
|
| 67 | } else { |
|
| 68 | throw new InvalidSettingsException("Configuration option '$key' is undefined"); |
|
| 69 | } |
|
| 70 | } |
|
| 71 | ||
| 72 | /** |
|
| 73 | * @param array $options |
|