public function add(AbstractOption $option) { if (array_key_exists($option->getName(), $this->options)) { throw new \InvalidArgumentException(sprintf('An option with the name %s exists already.', $option->getName())); } $this->options[$option->getName()] = $option; }