Resolve parameters in arguments.

@param array $arguments

@return array
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;
    }
792783
public function addArguments(array $arguments)
    {
        foreach ($arguments as $param => $value) {
            $this->addArgument($param, $value);
        }

        return $this;
    }
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;
	}
467930
public function parse($arguments)
    {
        if (!is_array($arguments)) {
            $arguments = explode(' ', $arguments);
        }
        $operands = array();
        $numArgs = count($arguments);
        for ($i = 0; $i < $numArgs; ++$i) {
            $arg = trim($arguments[$i]);
            if (empty($arg)) {
                continue;
            }
            if (($arg === '--') || ($arg === '-') || (mb_substr($arg, 0, 1) !== '-')){
                // no more options, treat the remaining arguments as operands
                $firstOperandIndex = ($arg == '--') ? $i + 1 : $i;
                $operands = array_slice($arguments, $firstOperandIndex);
                break;
            }
            if (mb_substr($arg, 0, 2) == '--') {
                $this->addLongOption($arguments, $i);
            } else {
                $this->addShortOption($arguments, $i);
            }
        } // endfor

        $this->addDefaultValues();

        // remove '--' from operands array
        foreach ($operands as $operand) {
            if ($operand !== '--') {
                $this->operands[] = $operand;
            }
        }
    }
799971
protected function normalizeArguments(array $arguments)
    {
        if (count($arguments) === 2) {
            return [$arguments[0] => $arguments[1]];
        }

        if ($arguments[0] instanceof Arrayable) {
            return $arguments[0]->toArray();
        }

        if (! is_array($arguments[0])) {
            $arguments[0] = [$arguments[0]];
        }

        return $arguments[0];
    }
1119774
protected static function parseArguments(array $arguments) {
    $string = '';
    foreach ($arguments as $name => $value) {
      if (is_null($value)) {
        $string .= ' --' . $name;
      }
      else {
        $string .= ' --' . $name . '=' . $value;
      }
    }
    return $string;
  }
428265
private function resolveArguments(array $argumentDefinitions)
    {
        $arguments = [];

        foreach ($argumentDefinitions as $argumentDefinition) {
            if ($argumentDefinition instanceof ServiceReference) {
                $argumentServiceName = $argumentDefinition->getName();

                $arguments[] = $this->get($argumentServiceName);
            } elseif ($argumentDefinition instanceof ParameterReference) {
                $argumentParameterName = $argumentDefinition->getName();

                $arguments[] = $this->getParameter($argumentParameterName);
            } else {
                $arguments[] = $argumentDefinition;
            }
        }

        return $arguments;
    }
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;
    }
44690
public function query(array $arguments = [])
    {
        return $this->plugger
            ->setModel($this)
            ->setAdapter(User::class)
            ->plugIn(get_users($arguments))
            ->getConnected();
    }
30010
public function parse($arguments = null)
    {
        $this->_options = [];
        $this->_values = [];

        if ($arguments === null) {
            if (isset($GLOBALS['argv'][1]) && $GLOBALS['argv'][1][0] === '/') {
                $arguments = [$GLOBALS['argv'][1]];
            } else {
                /** @noinspection CallableParameterUseCaseInTypeContextInspection */
                $arguments = array_slice($GLOBALS['argv'], 3);
            }
        }

        if (count($arguments) === 1 && $arguments[0][0] === '/') {
            $query = parse_url($arguments[0], PHP_URL_QUERY);
            parse_str($query, $this->_options);
            if (($fragment = parse_url($arguments[0], PHP_URL_FRAGMENT)) !== null) {
                $this->_values[] = $fragment;
            }
        } else {
            $this->_parse($arguments);
        }

        return $this;
    }
208770
private function resolveArguments(
        array $arguments,
        ValueResolverInterface $resolver,
        FixtureInterface $fixture,
        ResolvedFixtureSet $fixtureSet,
        GenerationContext $context
    ): array {
        $scope = $fixtureSet->getParameters()->toArray();

        $argumentPosition = 1;
        foreach ($arguments as $index => $argument) {
            if ($argument instanceof ValueInterface) {
                try {
                    $result = $resolver->resolve($argument, $fixture, $fixtureSet, $scope, $context);
                } catch (ResolutionThrowable $throwable) {
                    throw UnresolvableValueDuringGenerationExceptionFactory::createFromResolutionThrowable($throwable);
                }

                list($fixtureSet, $value) = [$result->getSet(), $result->getValue()];

                $arguments[$index] = $value;

                if (is_int($index)) {
                    $scope[$argumentPosition] = $value;
                } else {
                    $scope[$index] = $value;
                }

                $argumentPosition++;
            }
        }

        return [$arguments, $fixtureSet];
    }
1189874
protected function sanitizeCommandArguments(array $arguments)
    {
        $args       = array();
        $files      = array();
        $fileMode   = false;
        foreach ($arguments as $k => $v) {
            if ($v === '--' || $k === '--') {
                $fileMode   = true;
                continue;
            }
            if (is_int($k)) {
                if (strpos($v, '-') === 0) {
                    $args[]  = $this->sanitizeCommandArgument($v, null);
                } else if ($fileMode) {
                    $files[] = escapeshellarg($v);
                } else {
                    $args[]  = escapeshellarg($v);
                }
            } else {
                if (strpos($k, '-') === 0) {
                    $args[] = $this->sanitizeCommandArgument($k, $v);
                }
            }
        }
        return array($args, $files);
    }
509599
private function getParams(array $args)
    {
        if (count($args) == 0) {
            return [];
        }

        $params = array_slice($args, -1)[0];

        return is_array($params) ? $params : [];
    }
1263166
public function arguments(array $arguments = [])
    {
        if (empty($arguments)) {
            return $this->arguments;
        }

        foreach ($arguments as $key => $value) {
            if (!isset($this->requirements[$key])) {
                $this->arguments[$key] = $value;
                continue;
            }

            $this->assertArgumentValue($key, $this->requirements[$key], $value);
            $this->arguments[$key] = $value;
        }

        return $this->arguments;
    }
52653
private function resolveArguments(ReflectionClass $reflection, array $arguments, array $resolvers)
    {
        $newArguments = $arguments;

        foreach ($resolvers as $resolver) {
            $newArguments = $resolver->resolveArguments($reflection, $newArguments);
        }

        if (!$reflection->hasMethod('__construct')) {
            return $newArguments;
        }

        $constructor = $reflection->getConstructor();
        $newArguments = $this->argumentOrganiser->organiseArguments($constructor, $newArguments);
        $this->validator->validateArguments($constructor, $newArguments);

        return $newArguments;
    }
328953
private function resolveArgument($argument)
    {
        if (is_array($argument)) {
            return array_map(array($this, 'resolveArgument'), $argument);
        }

        if (!is_string($argument)) {
            return $argument;
        }

        $container = $this->kernel->getContainer();
        $container = $container->has('test.service_container') ? $container->get('test.service_container') : $container;

        if ($service = $this->getService($container, $argument)) {
            return $service;
        }

        $resolvedParam = $this->replaceParameters($container, $argument);

        if (!is_string($resolvedParam)) {
            return $resolvedParam;
        }

        return $this->escape($resolvedParam);
    }
859983
protected function processArguments($arguments)
    {
        if (false === is_array($arguments)) {
            return $arguments;
        }

        return array_map(function ($argument) {
            return (string) $argument;
        }, $arguments);
    }