| @@ 11-22 (lines=12) @@ | ||
| 8 | protected $parametersList = array(); |
|
| 9 | protected $parametersValues = array(); |
|
| 10 | ||
| 11 | public function __get($variable) |
|
| 12 | { |
|
| 13 | if (in_array($variable, $this->parametersList)) { |
|
| 14 | if (isset($this->parametersValues[$variable])) { |
|
| 15 | return $this->parametersValues[$variable]; |
|
| 16 | } else { |
|
| 17 | return null; |
|
| 18 | } |
|
| 19 | } else { |
|
| 20 | throw new InvalidArgumentException("Unknown configuration property " . get_called_class() . '->' .$variable); |
|
| 21 | } |
|
| 22 | } |
|
| 23 | ||
| 24 | public function __set($variable, $value) |
|
| 25 | { |
|
| @@ 48-55 (lines=8) @@ | ||
| 45 | $this->init(); |
|
| 46 | } |
|
| 47 | ||
| 48 | public function getParameter($parameter) |
|
| 49 | { |
|
| 50 | if (in_array($parameter, $this->parametersList)) { |
|
| 51 | return isset($this->parametersValues[$parameter]) ? $this->parametersValues[$parameter] : null; |
|
| 52 | } else { |
|
| 53 | throw new InvalidArgumentException("Unknown configuration property : " . get_called_class() . "->" . $parameter); |
|
| 54 | } |
|
| 55 | } |
|
| 56 | ||
| 57 | protected function init() |
|
| 58 | { |
|