think\console\input\Option::setDefault PHP Method

setDefault() public method

设置默认值
public setDefault ( mixed $default = null )
$default mixed 默认值
    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 = [];
            } elseif (!is_array($default)) {
                throw new \LogicException('A default value for an array option must be an array.');
            }
        }
        $this->default = $this->acceptValue() ? $default : false;
    }