Total Complexity | 10 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
6 | class Service implements Interfaces\IService |
||
7 | { |
||
8 | protected $parametersList = []; |
||
9 | protected $parametersValues = []; |
||
10 | |||
11 | 61 | public function __construct() |
|
13 | // Service constructor |
||
14 | 61 | } |
|
15 | |||
16 | 54 | public function __get($variable) |
|
17 | { |
||
18 | 54 | if (in_array($variable, $this->parametersList)) { |
|
19 | 53 | if (isset($this->parametersValues[$variable])) { |
|
20 | 53 | return $this->parametersValues[$variable]; |
|
21 | } |
||
22 | |||
23 | 5 | return null; |
|
24 | } |
||
25 | |||
26 | 1 | throw new InvalidArgumentException("Unknown configuration property " . get_called_class() . '->' .$variable); |
|
27 | } |
||
28 | |||
29 | 60 | public function __set($variable, $value) |
|
30 | { |
||
31 | 60 | if (in_array($variable, $this->parametersList)) { |
|
32 | 59 | $this->parametersValues[$variable] = $value; |
|
33 | |||
34 | 59 | return $this; |
|
35 | } |
||
36 | |||
37 | 2 | throw new InvalidArgumentException("Unknown configuration property " . get_called_class() . '->' . $variable); |
|
38 | } |
||
39 | |||
40 | 37 | public function configure($parameters = []) |
|
47 | 37 | } |
|
48 | |||
49 | 11 | public function getParameter($parameter) |
|
50 | { |
||
51 | 11 | return $this->$parameter; |
|
52 | } |
||
53 | |||
54 | 37 | protected function init() |
|
56 | 37 | } |
|
57 | } |
||
58 |