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