/**
  * Add an InputOption object.
  *
  * @param InputOption $option An InputOption object
  *
  * @throws \LogicException When option given already exist
  *
  * @api
  */
 public function addOption(InputOption $option)
 {
     if (isset($this->options[$option->getName()])) {
         throw new \LogicException(sprintf('An option named "%s" already exist.', $option->getName()));
     } else {
         if (isset($this->shortcuts[$option->getShortcut()])) {
             throw new \LogicException(sprintf('An option with shortcut "%s" already exist.', $option->getShortcut()));
         }
     }
     $this->options[$option->getName()] = $option;
     if ($option->getShortcut()) {
         $this->shortcuts[$option->getShortcut()] = $option->getName();
     }
 }
 /**
  * Checks whether the given option equals this one.
  *
  * @param InputOption $option
  *        	option to compare
  *        	
  * @return bool
  */
 public function equals(InputOption $option)
 {
     return $option->getName() === $this->getName() && $option->getShortcut() === $this->getShortcut() && $option->getDefault() === $this->getDefault() && $option->isArray() === $this->isArray() && $option->isValueRequired() === $this->isValueRequired() && $option->isValueOptional() === $this->isValueOptional();
 }
 /**
  * Adds an InputOption object.
  *
  * @param InputOption $option An InputOption object
  *
  * @throws \LogicException When option given already exist
  *
  * @api
  */
 public function addOption(InputOption $option)
 {
     if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
         throw new \LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
     }
     if ($option->getShortcut()) {
         foreach (explode('|', $option->getShortcut()) as $shortcut) {
             if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
                 throw new \LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
             }
         }
     }
     $this->options[$option->getName()] = $option;
     if ($option->getShortcut()) {
         foreach (explode('|', $option->getShortcut()) as $shortcut) {
             $this->shortcuts[$shortcut] = $option->getName();
         }
     }
 }