Process the arguments for $getopt

Stores operands using $addOperand callback.

@param GetOpt   $getopt
@param callable $setOption
@param callable $setCommand
@param callable $addOperand
@return bool
180410
public function process(GetOpt $getopt, callable $setOption, callable $setCommand, callable $addOperand)
    {
        while (($arg = array_shift($this->arguments)) !== null) {
            if ($this->isMeta($arg)) {
                // everything from here are operands
                foreach ($this->arguments as $argument) {
                    $addOperand($argument);
                }
                break;
            }

            if ($this->isValue($arg)) {
                $operands = $getopt->getOperands();
                if (empty($operands) && $command = $getopt->getCommand($arg)) {
                    $setCommand($command);
                } else {
                    $addOperand($arg);
                }
            }

            if ($this->isLongOption($arg)) {
                $setOption($this->longName($arg), function (Option $option = null) use ($arg) {
                    return $this->value($arg, null, $option);
                });
                continue;
            }

            // the only left is short options
            foreach ($this->shortNames($arg) as $name) {
                $requestedValue = false;
                $setOption($name, function (Option $option = null) use ($arg, $name, &$requestedValue) {
                    $requestedValue = true;
                    return $this->value($arg, $name, $option);
                });

                if ($requestedValue) {
                    // when there is a value it was the last option
                    break;
                }
            }
        }
        return true;
    }
206170
protected function getOption($option, $default = false)
    {
        return isset($this->options[$option])? $this->options[$option] : $default;
    }
377016
protected function setOption(int $option, bool $bool) : void
    {
        if ($bool) {
            $this->options |= $option;
        } else {
            $this->options &= ~ $option;
        }
    }
1071182
public function render(GetOpt $getopt, array $data = [])
    {
        $this->getOpt = $getopt;
        foreach ($data as $setting => $value) {
            $this->set($setting, $value);
        }

        // we always append the usage
        if ($this->usageTemplate) {
            $data['getopt'] = $getopt;
            $data['command'] = $getopt->getCommand();
            $helpText = $this->renderTemplate($this->usageTemplate, $data);
        } else {
            $helpText = $this->renderUsage();
        }

        if ($getopt->hasOperands() && empty($this->settings[self::HIDE_OPERANDS])) {
            $helpText .= $this->renderOperands();
        }

        // when we have options we add them too
        if ($getopt->hasOptions()) {
            if ($this->optionsTemplate) {
                $data['options'] = $getopt->getOptionObjects();
                $helpText .= $this->renderTemplate($this->optionsTemplate, $data);
            } else {
                $helpText .= $this->renderOptions();
            }
        }

        // when we have commands we render commands template
        if (!$getopt->getCommand() && $getopt->hasCommands()) {
            if ($this->commandsTemplate) {
                $data['commands'] = $getopt->getCommands();
                $helpText         .= $this->renderTemplate($this->commandsTemplate, $data);
            } else {
                $helpText .= $this->renderCommands();
            }
        }

        return $helpText;
    }
635311
static function fuse(&$opt1, $opt2) {
        return isset($opt1) ? $opt1 : (isset($opt2) ? $opt2 : null); 
    }
1095336
def set_gnu_getopt(self, gnu_getopt=True):
    
    self.__dict__['__use_gnu_getopt'] = gnu_getopt
    self.__dict__['__use_gnu_getopt_explicitly_set'] = True
1113657
function getOperation(opType) {
    var opname = Object.keys(APISPEC.operations)
        .filter(function(operation) {
            return operation === opType;
        });

    if (!opname.length) {
        throw new ReferenceError('Operation is not supported');
    }

    // avoid mutation
    return util._extend({}, APISPEC.operations[opname[0]]);
}
97296
public function addOptions($options)
    {
        if (is_string($options)) {
            $this->mergeOptions($this->optionParser->parseString($options));
        } elseif (is_array($options)) {
            $this->mergeOptions($this->optionParser->parseArray($options));
        } else {
            throw new \InvalidArgumentException("Getopt(): argument must be string or array");
        }
    }
207076
public function getOptional(/* ..., */$defaultValue) {
        $args = func_get_args();
        try {
            return call_user_func_array(array($this, "get"), array_slice($args, 0, -1));
        } catch (fphp\NotFoundSettingsException $e) {
            return $args[count($args) - 1];
        }
    }
358703
private function addToOptionCache(string $identifier, $option) : void
    {
        if (!isset($option[$identifier])) {
            return;
        }
        $cacheKey = "${option['command']}${option[$identifier]}";
        if (!isset($this->optionsCache[$cacheKey])) {
            $this->optionsCache[$cacheKey] = $option;
        } else {
            throw new OptionExistsException(
                "An argument option with $identifier {$option['command']} {$option[$identifier]} already exists."
            );
        }
    }
280174
protected function getLogicalResult(callable $logicalAndFunction, callable $logicalOrFunction)
    {
        switch ($this->operator) {
            case ConditionParser::LOGICAL_AND:
                $result = call_user_func($logicalAndFunction);
                break;
            case ConditionParser::LOGICAL_OR:
                $result = call_user_func($logicalOrFunction);
                break;
            default:
                throw InvalidConfigurationException::wrongBooleanNodeOperator($this->operator);
        }

        return $result;
    }
445996
public static void checkOptional(OptionSet options, String opt1, String opt2) {
        List<String> opts = Lists.newArrayList();
        opts.add(opt1);
        opts.add(opt2);
        checkOptional(options, opts);
    }
495633
public function processOptionApiClient()
    {
        $this->alert('API CLIENT PROCESS');

        // Verify option TABLE
        if (!in_array(strtoupper(trim($this->option('api-client'))), ['N','NO','FALSE'])) {
            $this->apiLumen = true;
        }

    }
679869
function setOption($option, $value)
    {
        $ret = true;
        if (array_key_exists($option, $this->_options)) {
            $this->_options[$option] = $value;
        } else {
            throw new InvalidArgumentException('Unknown option ' . $option);
        }
    }
874775
public function setOption()
    {
        $args = func_get_args();

        $options = [];

        if (is_array($args[0])) {
            foreach ($args[0] as $key => $value)
                $options[$key] = $value;
        } else {
            $options[$args[0]] = $args[1];
        }

        $this->options += $options;

        return $this;
    }
1141661
protected static function deleteOptionSetByIdAsyncWithHttpInfo($option_set_id) 
    {
        $returnType = '';  
        $request = self::deleteOptionSetByIdRequest($option_set_id); 

        return self::getHttpClient()
            ->sendAsync($request, self::createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    return [null, $response->getStatusCode(), $response->getHeaders()];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        $response->getBody()
                    );
                }
            );
    }
1357513
public function stream_set_option($option, $arg1, $arg2)
    {
        switch ($option) {
            case STREAM_OPTION_BLOCKING:
                // This works for the local adapter. It doesn't do anything for
                // memory streams.
                return stream_set_blocking($this->handle, $arg1);

            case STREAM_OPTION_READ_TIMEOUT:
                return  stream_set_timeout($this->handle, $arg1, $arg2);

            case STREAM_OPTION_READ_BUFFER:
                if ($arg1 === STREAM_BUFFER_NONE) {
                    return stream_set_read_buffer($this->handle, 0) === 0;
                }

                return stream_set_read_buffer($this->handle, $arg2) === 0;

            case STREAM_OPTION_WRITE_BUFFER:
                $this->streamWriteBuffer = $arg1 === STREAM_BUFFER_NONE ? 0 : $arg2;

                return true;
        }

        return false;
    }