构造参数 通过传入的参数

$app->build('Some\Class', [params..])

@param  array $dependencies 具体类型的构造函数参数数组
@param  array $parameters   传入的参数数组

@return array
437765
public function keyParametersByArgument(array $dependencies, array $parameters)
    {
        foreach ($parameters as $key => $value) {
            if (is_numeric($key)) {
                unset($parameters[$key]);
                $parameters[$dependencies[$key]->name] = $value;
            }
        }
        return $parameters;
    }
645534
public function getDependencies($type)
	{
		if (!isset($this->dependencies[$type]))
			return array();
		return array_keys($this->dependencies[$type]);
	}
1115026
public function make($abstract, array $parameters = array())
    {
        $abstract = $this->getAlias($this->normalize($abstract));
        //反复make同一抽象时， 返回同一个对象
        if (isset($this->instances[$abstract]) && !is_null($this->instances[$abstract])) {
            return $this->instances[$abstract];
        }
        //获取抽象类对应的具体对象
        $concrete = $this->getConcrete($abstract);
        //当前具体类型是可以build时，
        if ($this->isBuildable($concrete, $abstract)) {
            $object = $this->build($concrete, $parameters);
        } else {
            $object = $this->make($concrete, $parameters);
        }
        //若容器中有该具体类的扩展回调
        foreach ($this->getExtenders($abstract) as $extender) {
            $object = $extender($object, $this);
        }
        if ($this->isShared($abstract)) {
            $this->instances[$abstract] = $object;
        }
        $this->resoleved[$abstract] = true;
        return $object;
    }
369826
protected function transformDependency(ReflectionParameter $parameter, $parameters)
    {
        if (is_null($class = $parameter->getClass())) {
            return;
        }

        // The parameter references a class.
        else if (! $class->isSubclassOf(Model::class)) {
            return $this->container->make($class->name);
        }

        $identifier = Arr::first($parameters, function ($parameterKey) use ($parameter)
        {
            return $parameterKey === $parameter->name;
        });

        if (! is_null($identifier)) {
            $instance = $class->newInstance();

            return call_user_func(array($instance, 'find'), $identifier);
        }
    }
1260123
function (params) {
	var i = params.length, dependencies = [];
	while (i--) {
		dependencies[i] = `"${ params[i].name }"`;
	}

	return dependencies.join(", ");
}
102933
public function provider($name, $provider)
    {
        if (!is_array($provider) && is_callable($provider)) {
            $provider = [$provider];
        }
        if (!is_array($provider)) {
            throw new DependencyException(
                'Invalid provider passed to '.$name.', '.
                'it must be an array or a callable function.'
            );
        }

        $dependencies = $provider;
        $value = array_pop($dependencies);

        return $this->set($name, new Dependency($value, $name, $dependencies));
    }
946414
private function getDependencies(array $args, array &$arguments)
    {
        $objects = [];
        foreach ($arguments as $k => $v) {
            if (is_object($v)) {
                $objects[$k] = $v;
            }
        }

        $unShift = [];
        $args    = array_reverse($args);

        foreach ($args as $v) {
            $hasDefault = is_array($v);
            $dependency = $hasDefault ? $v[0] : $v;

            if ($objects) {
                $find = false;
                foreach ($objects as $k => $ins) {
                    if (! $ins instanceof $dependency) {
                        continue;
                    }

                    array_unshift($unShift, $ins);
                    unset($arguments[$k], $objects[$k]);

                    $find = true;
                    break;
                }

                if ($find) {
                    continue;
                }
            }

            $alias = $this->getDependencyAlias($dependency);
            if (! $alias) {
                if ($hasDefault) {
                    array_unshift($unShift, null);

                    continue;
                }

                throw new ContainerException("Unresolvable dependency resolving [{$dependency}]");
            }

            array_unshift($unShift, $this->get($alias));
        }
        unset($instance, $objects);

        $arguments = array_merge($unShift, $arguments);
        unset($unShift);
    }
999640
protected function getDependencies($dependencies, $params = [], $isRoute = false)
    {
        $resolving = [];

        foreach ($dependencies as $dependency) {
            if ($dependency->isDefaultValueAvailable()) {
                $resolving = $this->getDependencyDefaultValue($dependency, $params, $resolving, $isRoute);
            } elseif(isset($params[$dependency->name])) {
                $resolving[] = $params[$dependency->name];
            } else {
                if ($dependency->getClass() === null) {
                    throw new Exception("The [ $" . "{$dependency->name} ] is not instantiable.");
                }

                $className = $dependency->getClass()->name;

                if (!isset($this->resolved[$className])) {
                    $this->resolved[$className] = $this->make($className);
                    $resolving[] = $this->resolved[$className];
                } else {
                    $resolving[] = $this->resolved[$className];
                }
            }
        }

        return $resolving;
    }
1326256
protected function createBundles(array $dependencies)
    {
        foreach ($dependencies as $bundleClass) {
            $name = substr($bundleClass, strrpos($bundleClass, '\\') + 1);

            if (false === isset($this->bundles[$name])) {
                $bundle = new $bundleClass();
                $this->bundles[$name] = $bundleClass;
                $this->instances[$name] = $bundle;

                if ($bundle instanceof BundleDependencyInterface) {
                    $this->createBundles($bundle->getBundleDependencies());
                }
            }
        }

        return count($this->instances) > 0;
    }
337970
public static function getPackagesAndDependencies($packagesArray)
    {
        foreach ($packagesArray as $key => $value) {
            $packageFile = base_path("/vendor/{$key}/composer.json");

            if ($key !== 'php' && file_exists($packageFile)) {
                $json2 = file_get_contents($packageFile);
                $dependenciesArray = json_decode($json2, true);
                $dependencies = array_key_exists('require', $dependenciesArray) ? $dependenciesArray['require'] : 'No dependencies';
                $devDependencies = array_key_exists('require-dev', $dependenciesArray) ? $dependenciesArray['require-dev'] : 'No dependencies';

                $packages[] = [
                    'name' => $key,
                    'version' => $value,
                    'dependencies' => $dependencies,
                    'dev-dependencies' => $devDependencies
                ];
            }
        }

        return $packages;
    }
1205346
protected function validateDependencies($fixtureClass, $dependenciesClasses)
    {
        if (!is_array($dependenciesClasses) || empty($dependenciesClasses)) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Method "%s" in class "%s" must return an array of classes which are'
                    . ' dependencies for the fixture, and it must be NOT empty.',
                    'getDependencies',
                    $fixtureClass
                )
            );
        }

        if (in_array($fixtureClass, $dependenciesClasses)) {
            throw new \InvalidArgumentException(
                sprintf('Class "%s" can\'t have itself as a dependency', $fixtureClass)
            );
        }

        $loadedFixtureClasses = array_keys($this->fixtures);
        foreach ($dependenciesClasses as $class) {
            if (!in_array($class, $loadedFixtureClasses)) {
                throw new \RuntimeException(
                    sprintf(
                        'Fixture "%s" was declared as a dependency, but it should be added in fixture loader first.',
                        $class
                    )
                );
            }
        }

        return true;
    }
1222485
public function getDependencies()
    {
        $dependencies = [];
        if ($this->extendsClassDefinition && $this->extendsClassDefinition instanceof self) {
            $dependencies[] = $this->extendsClassDefinition;
        }

        foreach ($this->implementedInterfaceDefinitions as $interfaceDefinition) {
            if ($interfaceDefinition instanceof self) {
                $dependencies[] = $interfaceDefinition;
            }
        }

        return $dependencies;
    }
1303775
public function addDeferred($provider, array $dependencies)
    {
        foreach($dependencies as $name)
        {
            @list($type, $dependency) = explode('.', $name, 2);

            if(!$dependency)
            {
                $dependency = $type;

                $type = 'service';
            }
            else
            {
                if(!in_array($type, array('service', 'callable', 'factory')))
                {
                    $type = 'service';

                    $dependency = $name;
                }
            }

            $this->providersDeferred[$type.'.'.$dependency] = $provider;
        }

        return $this;
    }
83586
protected function transformDependency(ReflectionParameter $parameter, $parameters)
    {
        // Get owner class
        $class = $parameter->getClass();

        // We skip parameters with a type hint to avoid replacing model bindings
        if ($class && !$this->alreadyInParameters($class->name, $parameters)) {
            return $this->container->make($class->name);
        }

        return null;
    }
574231
protected function resolveDependencies(array $dependencies)
    {
        foreach ($dependencies as $dependency => $type) {
            call_user_func_array([$this, $type], [$dependency]);
        }
    }
687234
private function getDependencyInjectionParameters(array $reflectionParameters, array $arguments = []): array
    {
        $parameters = [];

        // Treat arguments
        $argumentsClass = [];
        foreach ($arguments as $name => &$argument) {
            if (!is_null($this->getContainer())) {
                // Service recursively
                if (is_string($argument) && substr($argument, 0, 1) == '@') {
                    $subServiceName = substr($argument, 1);
                    $argument = $this->getContainer()->get($subServiceName);
                }
            }

            // Get all classes of argument if it's an object.
            // It's necessary to know if argument can match with an injection.
            if (is_object($argument) && !($argument instanceof \stdClass)) {
                foreach ($this->getClassIndex()->getAllClasses($argument) as $class) {
                    $argumentsClass[$class][] = $name;
                }
            }
        }

        // Try to get all parameters values
        foreach ($reflectionParameters as $reflectionParameter) {
            if ($reflectionParameter instanceof \ReflectionParameter) {
                $parameters[$reflectionParameter->getName()] =
                    $this->getDependencyInjectionParameter($reflectionParameter,
                                                           $arguments,
                                                           $argumentsClass);
            }
        }

        return $parameters;
    }
370670
private function buildRequestParameters($parameters)
    {
        if (NULL === $parameters || empty($parameters)) {
            return null;
        }

        if (is_string($parameters)) {
            return $parameters;
        }

        $paramOut = '';
        foreach ($parameters as $key=>$value) {
            $paramOut .= $key.'=';
            if (is_array($value)){
                $paramOut .= join(',', $value);
            }else{
                $paramOut .= $value;
            }
            $paramOut .= '&';
        }

        return $paramOut;
    }