GetOptionKit\OptionParser::consumeOptionToken PHP Метод

consumeOptionToken() защищенный Метод

consume option value from current argument or from the next argument
protected consumeOptionToken ( Option $spec, $arg, $next, &$success = false ) : boolean
$spec Option
Результат boolean next token consumed?
    protected function consumeOptionToken(Option $spec, $arg, $next, &$success = false)
    {
        // Check options doesn't require next token before
        // all options that require values.
        if ($spec->isFlag()) {
            if ($spec->isIncremental()) {
                $spec->increaseValue();
            } else {
                $spec->setValue(true);
            }
            return 0;
        } else {
            if ($spec->isRequired()) {
                if ($next && !$next->isEmpty() && !$next->anyOfOptions($this->specs)) {
                    $spec->setValue($next->arg);
                    return 1;
                } else {
                    throw new RequireValueException("Option '{$arg->getOptionName()}' requires a value.");
                }
            } else {
                if ($spec->isMultiple()) {
                    if ($next && !$next->isEmpty() && !$next->anyOfOptions($this->specs)) {
                        $this->pushOptionValue($spec, $arg, $next);
                        return 1;
                    }
                } else {
                    if ($spec->isOptional() && $next && !$next->isEmpty() && !$next->anyOfOptions($this->specs)) {
                        $spec->setValue($next->arg);
                        return 1;
                    }
                }
            }
        }
        return 0;
    }