Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401]
1 <?php 2 3 namespace Box\Spout\Common\Manager; 4 5 /** 6 * Class OptionsManager 7 */ 8 abstract class OptionsManagerAbstract implements OptionsManagerInterface 9 { 10 const PREFIX_OPTION = 'OPTION_'; 11 12 /** @var string[] List of all supported option names */ 13 private $supportedOptions = []; 14 15 /** @var array Associative array [OPTION_NAME => OPTION_VALUE] */ 16 private $options = []; 17 18 /** 19 * OptionsManagerAbstract constructor. 20 */ 21 public function __construct() 22 { 23 $this->supportedOptions = $this->getSupportedOptions(); 24 $this->setDefaultOptions(); 25 } 26 27 /** 28 * @return array List of supported options 29 */ 30 abstract protected function getSupportedOptions(); 31 32 /** 33 * Sets the default options. 34 * To be overriden by child classes 35 * 36 * @return void 37 */ 38 abstract protected function setDefaultOptions(); 39 40 /** 41 * Sets the given option, if this option is supported. 42 * 43 * @param string $optionName 44 * @param mixed $optionValue 45 * @return void 46 */ 47 public function setOption($optionName, $optionValue) 48 { 49 if (in_array($optionName, $this->supportedOptions)) { 50 $this->options[$optionName] = $optionValue; 51 } 52 } 53 54 /** 55 * @param string $optionName 56 * @return mixed|null The set option or NULL if no option with given name found 57 */ 58 public function getOption($optionName) 59 { 60 $optionValue = null; 61 62 if (isset($this->options[$optionName])) { 63 $optionValue = $this->options[$optionName]; 64 } 65 66 return $optionValue; 67 } 68 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body