Пример #1
0
 /**
  * Parses the config array by passing the values through each method to check
  * validity against if the option exists.
  *
  * @access public
  * @param  array $config
  * @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
  * @throws \Khill\Lavacharts\Exceptions\InvalidConfigProperty
  */
 public function setOptions($config)
 {
     if (is_array($config) === false) {
         throw new InvalidConfigValue(static::TYPE . '->' . __FUNCTION__, 'array');
     }
     foreach ($config as $option => $value) {
         if ($this->options->hasOption($option) === false) {
             throw new InvalidConfigProperty(static::TYPE, __FUNCTION__, $option, $this->options->getDefaults());
         }
         call_user_func([$this, $option], $value);
     }
 }
Пример #2
0
 /**
  * Merges two Options objects and combines the options and values.
  *
  * @access public
  * @param  \Khill\Lavacharts\Options $options
  * @return \Khill\Lavacharts\Options
  * @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
  */
 public function merge(Options $options)
 {
     $this->extend($options->getDefaults());
     return $this->setOptions($options->getValues());
 }