Add an option

@param string $short One optional character
@param string $long Two or more optional characters
@param int $value Has this option a value? Is it required?

@return self Returns itself

@throws Exception on error
172102
public function addOption($short = null, $long = null, $value = self::NO_VALUE) {
        switch ($value) {
            case self::NO_VALUE:
            case self::OPTION_REQUIRED:
            case self::OPTION_NOT_REQUIRED:
                break;
            default:
                throw new Exception(
                    'Invalid value',
                    ExitApp::BAD_USER_INTERACTION
                );
        }

        $option = [
            'value' => $value
        ];

        if (isset($short)) {
            if (!is_string($short) || strlen($short) !== 1) {
                throw new Exception(sprintf(
                    'Bad short option "%s"',
                    $short
                ), ExitApp::BAD_USER_INTERACTION);
            }

            $option['short'] = $short;
        }

        if (isset($long)) {
            if (!is_string($long) || strlen($long) <= 1) {
                throw new Exception(sprintf(
                    'Bad long option "%s"',
                    $long
                ), ExitApp::BAD_USER_INTERACTION);
            }

            $option['long'] = $long;
        }

        $this->options[] = $option;

        return $this;
    }
728378
public function push($option, $value)
	{
		if ( ! is_string($option))
		{
			throw new \InvalidArgumentException('The option value must be a string type.');
		}
		
		$this->heap[$option][] = $value;
	}
1350217
public function option(string $option, ?string $value = null): ProcessBuilder
    {
        if ($option === '') {
            return $this;
        }

        if (strpos($option, '-') !== 0) {
            $option = sprintf('--%s', $option);
        }

        $this->arguments[] = $option;

        if ($value !== null) {
            $this->arguments[] = $value;
        }

        return $this;
    }
230481
public function setOption($option, $value)
    {
        switch ($option) {
            case FTPClient::TIMEOUT_SEC:
                if ($value <= 0) {
                    throw new Exception('Timeout value must be greater than zero');
                }
                break;

            case FTPClient::AUTOSEEK:
                if (!is_bool($value)) {
                    throw new Exception('Autoseek value must be boolean');
                }
                break;
            
            default:
                throw new Exception('Unsupported option');
                break;
        }

        return @ftp_set_option($this->connection, $option, $value);
    }
239209
public function addOption($value)
    {
        $options   = (array) $this->getOptions();
        $options[] = $value;

        $this->setData('options', $options);

        return $this;
    }
1192035
public void add(long value) {
        writeLock.lock();
        try {
            // do we need to evict anything?
            if (this.values.size() >= this.size) {
                Long oldValue = this.values.pollFirst();
                // subtract from running total
                this.total -= oldValue.longValue();
            }
            // add this new value onto the end
            this.values.add(value);
            // add to our total
            this.total += value;
        } finally {
            writeLock.unlock();
        }
    }
218872
private function addLongOption($name, $value)
    {
        if (!$this->definition->hasOption($name)) {
            throw new \RuntimeException(\sprintf('The "--%s" option does not exist.', $name));
        }

        $option = $this->definition->getOption($name);

        if (null !== $value && !$option->acceptValue()) {
            throw new \RuntimeException(\sprintf('The "--%s" option does not accept a value.', $name));
        }

        if (\in_array($value, ['', null], true) && $option->acceptValue() && \count($this->parsed)) {
            // if option accepts an optional or mandatory argument
            // let's see if there is one provided
            $next = \array_shift($this->parsed);
            $nextToken = $next[0];
            if ((isset($nextToken[0]) && '-' !== $nextToken[0]) || \in_array($nextToken, ['', null], true)) {
                $value = $nextToken;
            } else {
                \array_unshift($this->parsed, $next);
            }
        }

        if (null === $value) {
            if ($option->isValueRequired()) {
                throw new \RuntimeException(\sprintf('The "--%s" option requires a value.', $name));
            }

            if (!$option->isArray() && !$option->isValueOptional()) {
                $value = true;
            }
        }

        if ($option->isArray()) {
            $this->options[$name][] = $value;
        } else {
            $this->options[$name] = $value;
        }
    }
793069
private function setOptionValue(Option $Option, $value) {
        $Option->setValue($value);
        $long = $Option->getLong();
        if (isset($this->events[$long])) {
            $Handler = $this->events[$long];
            $Handler($long, $value);
        }
    }
1337769
public function setOptions($option, $value = null) 
	{
		Argument::i()
			->test(1, 'array', 'string')
			->test(2, 'scalar', 'null');
		
		if(is_array($option)) {
			$this->options = $option;
			return $this;
		}
		
		$this->options[$option] = $value;
		return $this;
	}
1231068
public function setOption($name, $value)
    {
        if (!is_string($name)) {
            throw new Exception('invalid options name');
        }
        $name = strtolower($name);
        if ($name == 'result_store') {
            $this->options['result_store'] = $value;
            $this->setResultStore($value);
        } elseif ($name == 'broker') {
            $this->options['broker'] = $value;
            $this->setBroker($value);
        }
        return $this;
    }
702099
public static function setOptionalValue( Option &$option, $arg )
    {
        if ( !self::isShortCode( $arg ) && !self::isLongCode( $arg ) )
        {
            if ( is_bool( $arg ) )
            {
                $option->value = ( bool )$arg;
            }
            elseif ( is_string( $arg ) )
            {
                $arg = trim( $arg );
            
                $option->value = $arg;
            }
        }
    }
419242
private function addShortOption($shortcut, $value) {
        if (!$this->definition->hasShortcut($shortcut)) {
            throw new \RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
        }

        $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
    }
230036
public function addOption($value, $display = null)
    {
        if (null === $display)
            $display = $value;

        $this->_options[] = array($value, $display);

        return $this;
    }
499817
public static function create($short, $long = null, $mode = GetOpt::NO_ARGUMENT)
    {
        return new static($short, $long, $mode);
    }
889302
public void putString(String value)
    {
        if (value.length() > Byte.MAX_VALUE * 2 + 1) {
            putLongString(value);
        }
        else {
            putShortString(value);
        }
    }
91207
public static function create($short, $long, $mode = Getopt::NO_ARGUMENT)
    {
    	return new self($short, $long, $mode);
    }
1219369
public function set(string $option, $value): self {
        $this->options[$option] = $value;

        return $this;
    }