/*
we're essentially aliasing php's getopt() functionality.
@return array
543688
static function get_arguments()
    {
        global $argv;
        $_ARG = array();
        foreach ($argv as $arg) {
            $temp_arg = explode('=', $arg);
            $_ARG[$temp_arg[0]] = null;
            if (isset($temp_arg[1])) {
                $_ARG[$temp_arg[0]] = $temp_arg[1];
            }
        }
        return $_ARG;
    }
14638
public function getOptionsAsArray()
    {
        $options      = $this->getOptions();
        $optionsArray = [];
        foreach ($options as $option) {
            $optionsArray[$option->getValue()] = $option->getNodeValue();
        }
        return $optionsArray;
    }
1133946
public function getOptionDefaults()
    {
        $values = array();
        foreach ($this->options as $option) {
            $values[$option->getName()] = $option->getDefault();
        }

        return $values;
    }
4881
protected function getOptions()
    {
        $options = array();

        foreach ($this->getModuleServices() as $module)
        {
            // Create a new option object based on the <option /> element.
            $tmp = \JHtml::_(
                'select.option', $module,
                \JText::_(trim((string) $module)), 'value', 'text'
            );

            // Add the option object to the result set.
            $options[] = $tmp;
        }

        reset($options);

        return $options;
    }
240569
public function getOptions() {

		$options = $this->options;

		unset($options['type']);
		$options['types'] = [$this->getEntityType()];

		$filters = $this->filters;
		if (!empty($filters)) {
			foreach ($filters as $filter) {
				$name = $filter['filter'];
				$target = $filter['target'];
				$options = $this->addFilterQuery($options, $name, $target);
			}
		}

		$sorts = $this->sorts;
		if (empty($sorts)) {
			$sorts[] = [
				'field' => 'time_created',
				'direction' => 'DESC',
			];
		}

		foreach ($sorts as $sort) {
			$field = $sort['field'];
			$direction = $sort['direction'];
			$options = $this->addSortQuery($options, $field, $direction);
		}

		if ($this->search_query) {
			$options = $this->addSearchQuery($options, $this->search_query, $this->search_options);
		}

		if ($this->search_query || !empty($this->filters)) {
			if (!isset($options['no_results'])) {
				$options['no_results'] = elgg_echo('sort:search:empty');
			}
		}

		return $options;
	}
109196
public function getOptionNames()
    {
        $names = [];
        foreach ($this->options as $option) {
            $names[] = $option->getLongName();
            $names[] = $option->getShortName();
        }

        return $names;
    }
654914
public function getAllOptions()
    {
        $result = [];

        foreach ($this->getOptionArray() as $index => $value) {
            $result[] = ['value' => $index, 'label' => $value];
        }

        return $result;
    }
118649
public function getCurlOptions()
    {
        $mandatoryOptions = array(
            CURLOPT_POST => true,
            CURLOPT_HEADER => true
        );

        $defaultOptions = array(
            CURLOPT_VERBOSE => false,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_SSL_VERIFYPEER => false
        );

        /* @noinspection AdditionOperationOnArraysInspection */
        $mergedArray = $mandatoryOptions + $this->curlOptions + $defaultOptions;

        if (strlen($this->proxyHost) > 0) {
            $proxyPort = self::DEFAULT_PROXY_PORT;
            if (strlen($this->proxyPort) > 0) {
                $proxyPort = $this->proxyPort;
            }

            $mergedArray[CURLOPT_PROXYTYPE] = $this->proxyType;
            $mergedArray[CURLOPT_PROXY] = $this->proxyHost;
            $mergedArray[CURLOPT_PROXYPORT] = $proxyPort;
        }

        return $mergedArray;
    }
334218
public function getOption()
    {
        $option = new Option();
        $method = $this->getReflection();

        $comment = $method->getDocComment();
        $parser = new OptionParser();
        $lines = [];
        foreach (preg_split('/\r\n|\n|\r/', $comment) as $line) {
            // /** or */ is skip.
            if (in_array(trim($line), ['/**', '*/', '**/'])) continue;

            $line = preg_replace('/^\s*?\*\s?/', '', $line);

            // options
            if($parser->isSupports($line)) {
                $option->addDefinition($parser->parse($line));
                continue;
            }

            // start char is "@" that is doc comment end signal.
            if (preg_match('/^@\w+/', $line)) continue;

            $lines[] = $line;
        }

        if ($options = $option->getDefinitions()) {
            $lines[] = $parser->formatter($option);
        }

        $option->setDescription(join(PHP_EOL, $lines));

        return $option;
    }
366762
public function getCurlOptions()
    {
        $mandatoryOptions = array(
            CURLOPT_POST => true,
            CURLOPT_HEADER => true
        );

        $defaultOptions = array(
            CURLOPT_VERBOSE => false,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_SSL_VERIFYPEER => false
        );

        $curlOptions = ($mandatoryOptions + $this->curlOptions + $defaultOptions);

        if ($this->hasProxyConfigured()) {
            $curlOptions[CURLOPT_PROXYTYPE] = $this->getProxyType();
            $curlOptions[CURLOPT_PROXY] = $this->getProxyHost();
            $curlOptions[CURLOPT_PROXYPORT] = $this->getProxyPort();
            $curlOptions[CURLOPT_PROXYUSERPWD] = $this->getProxyUserPwd();
        }

        return $curlOptions;
    }
766435
protected function getOptions()
    {
        return [
            ['dry-run', 'r', InputOption::VALUE_NONE, 'Dry run: run process but do not write anything'],
            ['editor', 'e', InputOption::VALUE_NONE, 'Open files which need to be edited at the end of the process'],
            ['force', 'f', InputOption::VALUE_NONE, 'Force files to be rewritten even if there is nothing to do'],
            ['translation', 't', InputOption::VALUE_NONE, 'Try to translate the lemma to the target language'],
            [
                'new-value',
                'l',
                InputOption::VALUE_OPTIONAL,
                'Value of new found lemmas (use %LEMMA for the lemma value or translation). Set it to null to provide translation fallbacks.',
                'TODO: %LEMMA',
            ],
            ['no-backup', 'b', InputOption::VALUE_NONE, 'Do not backup lang file (be careful, I am not a good coder)'],
            ['no-comment', 'c', InputOption::VALUE_NONE, 'Do not add comments in lang files for lemma definition'],
            ['no-date', 'd', InputOption::VALUE_NONE, 'Do not add the date of execution in the lang files'],
            ['no-obsolete', 'o', InputOption::VALUE_NONE, 'Do not write obsolete lemma (obsolete lemma will be removed)'],
            ['output-flat', 'w', InputOption::VALUE_NONE, 'Output arrays are flat (do not use sub-arrays and keep dots in lemma)'],
            ['silent', 's', InputOption::VALUE_NONE, 'Use this option to only return the exit code (use $? in shell to know whether there are missing lemma or nt)'],
            ['php-file-extension', 'x', InputOption::VALUE_OPTIONAL, 'PHP file extension', 'php'],
            ['disable-obsolete-check', 'z', InputOption::VALUE_NONE, 'Use this option to disable check for obsolete lemmas (obsolete lemma will be kept)'],
        ];
    }
26360
protected function getComputedOptions()
    {
        $unassigned = $this->option('unassigned');
        $orphaned = $this->option('orphaned');

        if (! $unassigned && ! $orphaned) {
            $unassigned = $orphaned = true;
        }

        return [$unassigned, $orphaned];
    }
395111
private function _getopt()
    {
        $shortopts  = OptionConfig::HELP;  // help
        $shortopts .= OptionConfig::PLATFORM . ':';          // platform
        $shortopts .= OptionConfig::OUTPUT_DIR . ':';        // output dir.
        $shortopts .= OptionConfig::SELENIUM_VER . ':';      // Selenium-Standalone-Server Ver.
        $shortopts .= OptionConfig::CHROME_DRIVER_VER . ':'; // ChromeDriver Ver.
        $shortopts .= OptionConfig::GECKO_DRIVER_VER . ':';  // GeckoDriver Ver.
        $shortopts .= OptionConfig::IE_DRIVER_VER . ':';     // IEDriverServer Ver.
        $shortopts .= OptionConfig::OS_BIT_VER . ':';        // bit of OS (Default 32).

        $longopts = array(
            OptionConfig::HELP_LONG . '::', // help
        );

        return getopt($shortopts, $longopts);
    }
1369923
public function getOptions()
    {
        $options = array();

        $options['backgroundColor'] = $this->getBackgroundColor()->__toString();
        $options['padding'] = $this->getPadding();
        $options['colorSaturation'] = $this->getColorSaturation();
        $options['grayscaleSaturation'] = $this->getGrayscaleSaturation();
        $options['colorLightness'] = $this->getColorLightness();
        $options['grayscaleLightness'] = $this->getGrayscaleLightness();

        if ($this->hues !== null) {
            $options['hues'] = $this->getHues();
        }

        return $options;
    }
1351638
public function getOptionsDescriptions()
    {
        return array_merge_recursive(parent::getOptionsDescriptions(), [
            self::OPTION_BASE_PATH => ['Base path to look for the json file', []],
            self::OPTION_FILENAME => ['Name of the file to load', []],
            self::OPTION_TYPE => ['Name of the type', []],//e.g. body or headers
        ]);
    }
720224
public function getOptions()
    {
        $parentOptions = parent::getOptions();
        return array_merge($parentOptions, [
            ['lucid', false, InputOption::VALUE_NONE, 'Lucid architecture'],
            ['domain', false, InputOption::VALUE_NONE, 'Install in a subdomain'],
        ]);
    }
425088
private function getCliOptions()
    {
        $validOptions = [];

        foreach ($this->getOptions() as $option) {
            $key = $option[0];
            $validOptions[$key] = $this->option($key);
        }

        return array_filter($validOptions);
    }