1 | <?php |
||
10 | abstract class OptionsManagerAbstract implements OptionsManagerInterface |
||
11 | { |
||
12 | const PREFIX_OPTION = 'OPTION_'; |
||
13 | |||
14 | /** @var string[] List of all supported option names */ |
||
15 | private $supportedOptions = []; |
||
16 | |||
17 | /** @var array Associative array [OPTION_NAME => OPTION_VALUE] */ |
||
18 | private $options = []; |
||
19 | |||
20 | /** |
||
21 | * OptionsManagerAbstract constructor. |
||
22 | */ |
||
23 | 219 | public function __construct() |
|
28 | |||
29 | /** |
||
30 | * @return array List of supported options |
||
31 | */ |
||
32 | abstract protected function getSupportedOptions(); |
||
33 | |||
34 | /** |
||
35 | * Sets the default options. |
||
36 | * To be overriden by child classes |
||
37 | * |
||
38 | * @return void |
||
39 | */ |
||
40 | abstract protected function setDefaultOptions(); |
||
41 | |||
42 | /** |
||
43 | * Sets the given option, if this option is supported. |
||
44 | * |
||
45 | * @param string $optionName |
||
46 | * @param mixed $optionValue |
||
47 | * @return void |
||
48 | */ |
||
49 | 219 | public function setOption($optionName, $optionValue) |
|
55 | |||
56 | /** |
||
57 | * @param string $optionName |
||
58 | * @return mixed|null The set option or NULL if no option with given name found |
||
59 | */ |
||
60 | 205 | public function getOption($optionName) |
|
70 | } |
||
71 |