public function InputOption::setDefault in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/console/Input/InputOption.php \Symfony\Component\Console\Input\InputOption::setDefault()
Sets the default value.
Parameters
mixed $default The default value:
Throws
\LogicException When incorrect default value is given
1 call to InputOption::setDefault()
- InputOption::__construct in vendor/symfony/ console/ Input/ InputOption.php 
- Constructor.
File
- vendor/symfony/ console/ Input/ InputOption.php, line 155 
Class
- InputOption
- Represents a command line option.
Namespace
Symfony\Component\Console\InputCode
public function setDefault($default = null) {
  if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
    throw new \LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
  }
  if ($this
    ->isArray()) {
    if (null === $default) {
      $default = array();
    }
    elseif (!is_array($default)) {
      throw new \LogicException('A default value for an array option must be an array.');
    }
  }
  $this->default = $this
    ->acceptValue() ? $default : false;
}