$value) { $setter = 'set' . str_replace(' ', '', ucwords(str_replace('_', ' ', $key))); if (method_exists($this, $setter)) { $this->{$setter}($value); } elseif (array_key_exists($key, $this->options)) { $this->options[$key] = $value; } else { throw new Exception\InvalidArgumentException( sprintf( 'The option "%s" does not have a matching %s setter method or options[%s] array key', $key, $setter, $key ) ); } } return $this; } /** * Retrieve options representing object state * * @return array */ public function getOptions() { return $this->options; } /** * Invoke filter as a command * * Proxies to {@link filter()} * * @param mixed $value * @throws Exception\ExceptionInterface If filtering $value is impossible * @return mixed */ public function __invoke($value) { return $this->filter($value); } /** * @param mixed $options * @return bool */ protected static function isOptions($options) { return (is_array($options) || $options instanceof Traversable); } }