Convert array of arguments into string

@param array $arguments
@return string
426882
protected function _argsToString(array $arguments) {
		$stringArguments = '';
		foreach ($arguments as $name => $value) {
			if (is_numeric($name)) {
				$stringArguments .= ' ' . $value;
			} else {
				$stringArguments .= ' ' . $name . ' ' . ProcessUtils::escapeArgument($value);
			}
		}

		return $stringArguments;
	}
1300343
public function addArguments(?string $arguments = null)
    {
        $args = [];
        preg_match_all('/(?P<argument>\w+):(?P<value>[\w+\-]+)/', $arguments, $matches);
        if (isset($matches['argument'])) {
            foreach ($matches['argument'] as $key => $argKey) {
                if (isset($matches['value'][$key])) {
                    $args[$argKey] = $matches['value'][$key];
                }
            }
        }
        $this->arguments = $args;
    }
559209
protected function mapArguments(array $arguments)
    {
        $keys = isset($this->mappableArguments[$this->element()]) ? $this->mappableArguments[$this->element()] : [];

        return array_combine(array_slice($keys, 0, count($arguments)), $arguments);
    }
859983
protected function processArguments($arguments)
    {
        if (false === is_array($arguments)) {
            return $arguments;
        }

        return array_map(function ($argument) {
            return (string) $argument;
        }, $arguments);
    }
344439
private function convertArgument($argument)
    {
        if (is_string($argument) && 0 < strlen($argument) && '@' === $argument[0]) {
            $argument = new Reference(substr($argument, 1));
        }

        return $argument;
    }
1316610
protected function getArgumentsUsage(array $arguments) {
        $usage = '';

        foreach ($arguments as $argument) {
            $name = $argument->getName();
            $info = '';

            if ($argument->isRequired()) {
                if ($argument->isMultiple()) {
                    $info .= "$name...";
                } else {
                    $info .= "$name";
                }
            } else {
                if ($argument->isMultiple()) {
                    $info .= "$name... ?";
                } else {
                    $info .= "$name ?";
                }
            }

            $usage .= " \<<green>$info</green>>";
        }

        return $usage;
    }
1249745
protected function parseArguments(array $arguments): array
	{
		$parsed = [];

		$argumentNumber = 0;

		foreach($arguments as $argument)
		{
			if(preg_match(static::NAMED_ARGUMENT_REGEX, $argument) === 1)
			{
				[$name, $value] = explode('=', substr($argument, 2), 2) + [null, null];

				$parsed[$name] = $value === null ? true : $value;
			}
			else
			{
				$parsed['arg' . $argumentNumber++] = $argument;
			}
		}

		return $parsed;
	}
1199219
public static function prepareCommand(array $args)
    {
        $return = '*' . \count($args) . "\r\n";
        foreach ($args as $arg) {
            $return .= '$' . \strlen($arg) . "\r\n" . $arg . "\r\n";
        }

        return $return;
    }
694289
public function getArguments( $arguments = array() )
    {
        $_results = array(
            'original' => $arguments,
            'rebuilt'  => array(),
            'options'  => array(),
        );

        //	Our return options array...
        $_options = array();

        //	Rebuild args...
        for ( $_i = 0, $_count = count( $arguments ); $_i < $_count; $_i++ )
        {
            $_argument = $arguments[$_i];
            $_value = trim( substr( $_argument, 0, strpos( $_argument, '=' ) ) );

            if ( $_value && $_value[0] == '-' && $_value[1] == '-' )
            {
                $_options[substr( $_value, 2 )] = str_replace( $_value . '=', '', $_argument );
            }
            elseif ( $_value && $_value[0] == '-' )
            {
                $_options[substr( $_value, 1 )] = str_replace( $_value . '=', '', $_argument );
            }
            else
            {
                $_results['rebuilt'][] = $arguments[$_i];
            }
        }

        $_results['options'] = $_options;

        //	Return the processed results...
        return $_results;
    }
766271
protected function resolveArgumentsParameters(array $arguments)
    {
        foreach ($arguments as $argument => &$value) {
            if (is_string($value) === false || preg_match('/%[\S_\-]+%/', $value, $matches) === false) {
                continue;
            }

            $name = $matches[0];

            if (array_key_exists($name, $this->parameters) === false) {
                continue;
            }

            if (is_string($this->parameters[$name])) {
                $value = str_replace($name, $this->parameters[$name], (string) $value);

                continue;
            }

            $value = $this->parameters[$name];
        }

        return $arguments;
    }
525619
private static function parseParams(array $arguments): string
    {
        if (0 === count($arguments)) {
            return '';
        }

        $arguments = array_map(function ($argument) {
            return beautify_parse('<argument:argument>', [
                'argument' => sprintf('"%s"', $argument),
            ]);
        }, $arguments);

        $parameters = implode(', ', $arguments);

        return sprintf('(%s)', $parameters);
    }
1208348
protected function extractInternalArguments(array &$arguments)
    {
        $internalArguments = [];
        foreach ($arguments as $argumentKey => &$argumentValue) {
            if (substr($argumentKey, 0, 2) === '__') {
                $internalArguments[$argumentKey] = $argumentValue;
                unset($arguments[$argumentKey]);
                continue;
            }
            if (substr($argumentKey, 0, 2) === '--' && is_array($argumentValue)) {
                $internalArguments[$argumentKey] = $this->extractInternalArguments($argumentValue);
                if ($internalArguments[$argumentKey] === []) {
                    unset($internalArguments[$argumentKey]);
                }
                if ($argumentValue === []) {
                    unset($arguments[$argumentKey]);
                }
            }
        }
        return $internalArguments;
    }
506223
protected function buildConnectString($driver, array $arguments)
	{
		$options = array_map(function ($key) use ($arguments) {
			return sprintf('%s=%s', $key, $arguments[$key]);
		}, array_keys($arguments));

		return $driver.':'.implode(';', $options);
	}
1201595
protected function prepareScriptArguments(array $arguments)
    {
        $args = [];
        foreach ($arguments as $key => $value) {
            if ($value instanceof WebDriverElement) {
                $args[$key] = ['ELEMENT' => $value->getID()];
            } else {
                if (is_array($value)) {
                    $value = $this->prepareScriptArguments($value);
                }
                $args[$key] = $value;
            }
        }

        return $args;
    }
171862
protected function _buildArguments($arguments)
    {
        $output = [];

        foreach ($arguments as $argument => $value) {
            $output[] = $argument . ' ' . $value;
        }

        return implode(' ', $output);
    }
691433
public function prepare($command, array $arguments = array())
    {
        $commandline = $command;

        foreach ($arguments as $option => $value) {
            if (is_bool($value)) {
                if ($value === true) {
                    $commandline .= ' ' . $option;
                }
            } else {
                $seperator = ' ';
                if (!is_integer($option)) {
                    $commandline .= ' ' . $option;
                    if (substr($option, -1, 1) == '=') {
                        $seperator = '';
                    }
                }
                $commandline .= $seperator . ProcessUtils::escapeArgument($value);
            }
        }

        return $commandline;
    }
406921
protected function _toQuerystring($parameters) {
		$out = '';
		$keys = array_keys($parameters);
		$count = count($parameters);
		for ($i = 0; $i < $count; $i++) {
			$out .= $keys[$i] . '=' . $parameters[$keys[$i]];
			if ($i < $count - 1) {
				$out .= '&';
			}
		}
		return $out;
	}