Parse arguments passed to the script.

@return array The arguments
325486
private function parseArguments()
    {
        $args = $_SERVER['argv'];

        // The first argument is the script name, so drop it
        array_shift($args);

        // Loop through each of the arguments
        foreach ($args as $index => $task) {
            if (strpos($task, '-') === 0) {
                // Argument is an option, so we remove it
                unset($args[$index]);

                // If the next argument is the option's value,
                // remove that as well.
                $option = preg_replace('/^[-]{1,2}/', '', $task);
                if (isset($args[$index + 1]) && $args[$index + 1] === $this->options->{$option}) {
                    unset($args[$index + 1]);
                }
                continue;
            }
        }

        return $this->args = $args;
    }
1005163
private static function parseCommands(array $arguments):array
    {
        $commands = [];
        foreach ($arguments as $one) {
            if (strpos($one, '--') === false) {
                $commands[] = $one;
            }
        }
        return ($commands);
    }
1194816
def parse_arguments():
    """"""
    parser = create_parser()
    args = parser.parse_args()
    if not args.role_requirements_old_commit:
        args.role_requirements_old_commit = args.role_requirements
    if not args.rpc_product_old_commit:
        args.rpc_product_old_commit = args.rpc_product
    return args
317638
private function parseArgs(array $args) : string
    {
        if (!is_array($args)) return false;
        $components = array();
        if (count($args) == 1 && is_string($args[0])) {
            $components['src'] = $args[0];
            return $this->makeLink($components);
        } elseif (count($args) == 1 && is_array($args)) {
            $components = $args[0];
            return $this->makeLink($components);
        } elseif (count($args) == 2 && is_string($args[0]) && is_array($args[1])) {
            $args[1]['src'] = $args[0];
            $components = $args[1];
            return $this->makeLink($components);
        } elseif (count($args) == 2 && is_string($args[0]) && is_string($args[1])) {
            return '<script type="'.$args[1].'">'."\n".$args[0]."\n</script>\n";
        }
        Core::i()->log->warning('Unable to interpret script. Not added.');
        return false;
    }
1370781
protected function getCliParams() {
		if (empty($_SERVER['argv'])) {
			return [];
		}
		
		$params = preg_grep('/^\-\-zdebug:/', $_SERVER['argv']);
		
		if (empty($params)) {
			return [];
		}
		
		return array_map(function($in) {
			return str_replace('--zdebug:', '', $in);
		}, $params);
	}
719841
public static function parseCommand()
    {
        global $argv;
        foreach($argv as $file)
        {
            $ext = pathinfo($file, PATHINFO_EXTENSION );
            if($ext !== 'php')
            {
                continue;
            }
            if(is_file($file))
            {
                static::$_startFiles[$file] = $file;
                include_once $file;
            }
        }
    }
937938
private function parseEntitiesArguments(){

		$args = array();
		while( true ){
			$arg = $this->MatchFuncs( array('parseEntitiesAssignment','parseExpression') );
			if( !$arg ){
				break;
			}

			$args[] = $arg;
			if( !$this->MatchChar(',') ){
				break;
			}
		}
		return $args;
	}
1068972
public function arguments()
    {
        
        if ($this->optind < $this->argc) {
            for ($i = $this->optind; $i < $this->argc; $i++) {
                $this->arguments[] = $this->argv[$i];
            }
            
        }
        
        return $this->arguments;
    }
858852
protected function get_field_arguments(){
        $args = parent::get_field_arguments();
        $args['class'] = 'token-input';
        $url = $this->get_endpoint();
        if( !empty($this->args) ){
            $url = add_query_arg($this->args, $url);
        }
        $args['data-endpoint'] = $url;
        $args['placeholder'] = $this->__('Type and search...');
        return $args;
    }
58671
protected function get_field_arguments(){
		$args = parent::get_field_arguments();
		if( $this->min ){
			$args['min'] = $this->min;
		}
		if( $this->max ){
			$args['max'] = $this->max;
		}
		if( is_admin() ){
			$args['class'] .= ' number-input';
		}
		unset($args['data-max-length']);
		unset($args['data-min-length']);
		$args['step'] = $this->step;
		return $args;
	}
103746
protected function parseArguments()
	{
		// Get the list of argument values from the environment.
		$args = $_SERVER['argv'];

		// Set the path used for program execution and remove it form the program arguments.
		$this->executable = array_shift($args);

		// We use a for loop because in some cases we need to look ahead.
		for ($i = 0; $i < count($args); $i++)
		{
			// Get the current argument to analyze.
			$arg = $args[$i];

			// First let's tackle the long argument case.  eg. --foo
			if (strlen($arg) > 2 && substr($arg, 0, 2) == '--')
			{
				// Attempt to split the thing over equals so we can get the key/value pair if an = was used.
				$arg = substr($arg, 2);
				$parts = explode('=', $arg);
				$this->data[$parts[0]] = true;

				// Does not have an =, so let's look ahead to the next argument for the value.
				if (count($parts) == 1 && isset($args[$i + 1]) && preg_match('/^--?.+/', $args[$i + 1]) == 0)
				{
					$this->data[$parts[0]] = $args[$i + 1];

					// Since we used the next argument, increment the counter so we don't use it again.
					$i++;
				}
				elseif (count($parts) == 2)
				// We have an equals sign so take the second "part" of the argument as the value.
				{
					$this->data[$parts[0]] = $parts[1];
				}
			}

			// Next let's see if we are dealing with a "bunch" of short arguments.  eg. -abc
			elseif (strlen($arg) > 2 && $arg[0] == '-')
			{
				// For each of these arguments set the value to TRUE since the flag has been set.
				for ($j = 1; $j < strlen($arg); $j++)
				{
					$this->data[$arg[$j]] = true;
				}
			}

			// OK, so it isn't a long argument or bunch of short ones, so let's look and see if it is a single
			// short argument.  eg. -h
			elseif (strlen($arg) == 2 && $arg[0] == '-')
			{
				// Go ahead and set the value to TRUE and if we find a value later we'll overwrite it.
				$this->data[$arg[1]] = true;

				// Let's look ahead to see if the next argument is a "value".  If it is, use it for this value.
				if (isset($args[$i + 1]) && preg_match('/^--?.+/', $args[$i + 1]) == 0)
				{
					$this->data[$arg[1]] = $args[$i + 1];

					// Since we used the next argument, increment the counter so we don't use it again.
					$i++;
				}
			}

			// Last but not least, we don't have a key/value based argument so just add it to the arguments list.
			else
			{
				$this->args[] = $arg;
			}
		}
	}
1314902
public function parse_query_args( $args ) {
		$query_args = [
			'frontend' => $args,
			'backend'  => $args,
		];

		if ( isset( $args['frontend'] ) || isset( $args['backend'] ) ) {
			foreach ( [ 'frontend', 'backend' ] as $query_type ) {
				$query_args[ $query_type ] = isset( $args[ $query_type ] )
					? $args[ $query_type ]
					: [];
			}
		}

		return $query_args;
	}
1317709
public function getArguments()
    {
        $returnArray = [];
        foreach ($this->commandArguments as $argument) {
            $returnArray[$argument->getName()] = $argument->getValue();
        }
        return $returnArray;
    }
143612
public function getArguments(): array
    {
        // We will need to process the arguments and merge them.
        $arguments = parent::getArguments();

        // If we have outfile setup don't act!
        foreach ($arguments as $argument) {
            if (strstr($argument, '-outfile') !== false) {
                return $arguments;
            }
        }

        if ($this->isOutSourceEqual()) // Check if not already specified
        {
            $this->outFileTemp = tempnam(sys_get_temp_dir(), 'img-prfy-');
            $arguments[] = '-outfile '.escapeshellarg($this->outFileTemp);
        } else {
            $arguments[] = '-outfile '.escapeshellarg($this->getOutFile());
        }

        return $arguments;
    }
191231
private function _parseArgs(array $args)
	{
		$arg = '';
		if(count($args) > 0)
		{
			foreach($args as $number => $argument)
			{
				if($number === 0)
				{
					$arg .= $argument;
				}
				else
				{
					$arg .= ', ' . $argument;
				}
			}
		}

		return $arg;
	}
519360
private function args_get()
    {
        $default = [];
        foreach ($this->config['args'] as $arg => $info) {
            if (isset($info['default']))
                $default[str_replace(':', '', $arg)] = $info['default'];
        }
        $this->args = array_merge(
            $default, getopt('h', array_keys($this->config['args']))
        );
    }
642423
protected function _parseArgs()
    {
        foreach ($_SERVER['argv'] as $index => $argument) {
            if (isset($this->_actionArgsMap[$argument])) {
                $this->_action = $argument;
                unset($_SERVER['argv'][$index]);
                break;
            }
            unset($_SERVER['argv'][$index]);
        }

        parent::_parseArgs();
    }