Extract the constructor arguments

@param array $arguments
@return mixed
763802
public function constructorArgs($arguments)
    {
        $constructArguments = array();

        if (is_array($arguments)) {
            foreach ($arguments as $argument) {
                if (is_array($argument)) {
                    if ($argument['type'] == 'datetime') {
                        $constructArguments[] = new \DateTime($argument['value']);
                    } elseif ($argument['type'] == 'reference') {
                        $constructArguments[] = $this->loader->getReference($argument['value']);
                    } else {
                        $constructArguments[] = $argument['value'];
                    }
                } else {
                    $constructArguments[] = $argument;
                }
            }
        } else {
            $constructArguments[] = $arguments;
        }

        return $constructArguments;
    }
583341
public function extractParameters(array $conditions)
    {
        preg_match_all('/{(\w+)}/', $this->regrex, $matches, PREG_PATTERN_ORDER);

        array_map(function ($parameter) use ($conditions) {
            if (isset($conditions[$parameter])) {
                return $this->parameters[$parameter] = $conditions[$parameter];
            }

            return $this->parameters[$parameter] = self::DEFAULT_REGREX;
        }, $matches[1]);

        return $this;
    }
949197
private function getInjectionProviderParams(Argument $argument) : array
    {
        $param = $argument->get();
        $class = $param->getDeclaringClass();
        if (! $class instanceof \ReflectionClass) {
            throw new \LogicException; // @codeCoverageIgnore
        }
        $method = $param->getDeclaringFunction();
        $this->setQualifiers($method, $param);

        return [
            new Node\Arg(new Scalar\String_((string) $argument)),
            new Expr\Array_([
                new Expr\ArrayItem(new Scalar\String_($class->name)),
                new Expr\ArrayItem(new Scalar\String_($method->name)),
                new Expr\ArrayItem(new Scalar\String_($param->name))
            ])
        ];
    }
1064790
public static function make(array $arguments = [])
    {
        $class = static::getFacadeAccessor();

        try {
            $reflection = new \ReflectionClass(static::getFacadeAccessor());
            $parameters = $reflection->getConstructor()->getParameters();
        } catch (\Throwable $error) {
            throw new \Exception('Wrong parameter', 0, $error);
        }

        return new $class(...static::composeMakeParameters($parameters, $arguments));
    }
1051717
protected function filterPrefix(array $arguments)
    {
        if (empty($arguments)) {
            throw new InvalidArgumentException('The arguments cannot be empty');
        }

        $path = array_shift($arguments);

        if (! Assert::stringNotEmpty($path)) {
            throw new InvalidArgumentException(
                sprintf('"%s" path must be string', __METHOD__)
            );
        }

        list($prefix, $path) = $this->getPrefixAndPath($path);
        array_unshift($arguments, $path);
        unset($path);

        return [$prefix, $arguments];
    }
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;
            }
        }
    }
544650
public function filterPrefix(array $arguments)
    {
        if (empty($arguments)) {
            throw new \InvalidArgumentException('At least one argument needed');
        }

        $path = &$arguments[0];

        if (!\is_string($path)) {
            throw new \InvalidArgumentException('First argument should be a string');
        }

        [$prefix, $path] = $this->getPrefixAndPath($path);

        return [$prefix, $arguments];
    }
1088919
private function processArguments(array $arguments)
    {
        foreach ($arguments as $argument) {
            if (is_array($argument)) {
                $this->processArguments($argument);
            } elseif ($argument instanceof Reference) {
                $this->graph->connect(
                    $this->currentId,
                    $this->currentDefinition,
                    $this->getDefinitionId((string) $argument),
                    $this->getDefinition((string) $argument),
                    $argument
                );
            } elseif ($argument instanceof Definition) {
                $this->processArguments($argument->getArguments());
                $this->processArguments($argument->getMethodCalls());
                $this->processArguments($argument->getProperties());

                if (is_array($argument->getFactory())) {
                    $this->processArguments($argument->getFactory());
                }
            }
        }
    }
936467
public static function constructStringFromArguments(array $arguments): string
    {
        $result = '';
        foreach ($arguments as $argument) {
            $result .= ' ' . $argument;
        }

        return $result;
    }
1279344
public static function getInstance(array $arguments)
    {
        if (in_array('-nc', $arguments) || in_array('--no-color', $arguments)) {
            return new VerboseLogger(static::getLogLevel($arguments));
        }

        return new ColoredVerboseLogger(static::getLogLevel($arguments));
    }
887192
public function passthru(array $arguments = [])
    {
        passthru($this->getBin() . $this->prepareCommand($arguments), $exitCode);
        return $exitCode;
    }
785273
public function invokeArguments(array $arguments)
    {
        $parsedArguments = $this->argumentParser->parse($arguments, $this->getParameters());

        return call_user_func_array($this->callable, $parsedArguments);
    }
545575
protected function _parseArguments($arguments) {
		$words = null;
		$function = $arguments[0];
		unset($arguments[0]);
		if (!in_array($function, array_merge($this->validMethods, ['all']))) {
			$function = $this->_getMethod();
		}

		$arguments = array_reverse($arguments);
		if (count($arguments) == 0) {
			$words = $this->_getWords();
		} else {
			while (count($arguments) > 0) {
				$words .= array_pop($arguments);
				if (count($arguments) > 0) {
					$words .= ' ';
				}
			}
		}

		return ['method' => $function, 'words' => $words];
	}
30875
protected function removeTrailingArguments(array $arguments)
    {
        $trailing = array_splice($arguments, array_search('--', $arguments));
        array_shift($trailing);
        $this->trailing = implode(' ', $trailing);

        return $arguments;
    }
181370
private function extract(string $method, array $arguments)
    {
        try {
            $serializedArguments = serialize($arguments);
        } catch (\Exception $exception) {
            // If arguments are not serializable, skip the cache
            return $this->propertyInfoExtractor->{$method}(...$arguments);
        }

        // Calling rawurlencode escapes special characters not allowed in PSR-6's keys
        $encodedMethod = \rawurlencode($method);
        if (\array_key_exists($encodedMethod, $this->arrayCache) && \array_key_exists($serializedArguments, $this->arrayCache[$encodedMethod])) {
            return $this->arrayCache[$encodedMethod][$serializedArguments];
        }

        $item = $this->cacheItemPool->getItem($encodedMethod);

        $data = $item->get();
        if ($item->isHit()) {
            $this->arrayCache[$encodedMethod] = $data[$encodedMethod];
            // Only match if the specific arguments have been cached.
            if (\array_key_exists($serializedArguments, $data[$encodedMethod])) {
                return $this->arrayCache[$encodedMethod][$serializedArguments];
            }
        }

        // It's possible that the method has been called, but with different
        // arguments, in which case $data will already be initialized.
        if (!$data) {
            $data = [];
        }

        $value = $this->propertyInfoExtractor->{$method}(...$arguments);
        $data[$encodedMethod][$serializedArguments] = $value;
        $this->arrayCache[$encodedMethod][$serializedArguments] = $value;
        $item->set($data);
        $this->cacheItemPool->save($item);

        return $this->arrayCache[$encodedMethod][$serializedArguments];
    }
1157792
private function getArguments($matches)
	{
		$arguments = array();

		foreach ($matches as $key => $match) {
			if ($key === 0) continue;

			if (strlen($match) > 0) {
				$arguments[] = $match;
			}
		}

		return $arguments;
	}