芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/public_html/mctv/vendor/php-di/php-di/src/Invoker/FactoryParameterResolver.php
* @author Matthieu Napoli
*/ class FactoryParameterResolver implements ParameterResolver { /** * @var ContainerInterface */ private $container; public function __construct(ContainerInterface $container) { $this->container = $container; } public function getParameters( ReflectionFunctionAbstract $reflection, array $providedParameters, array $resolvedParameters ) : array { $parameters = $reflection->getParameters(); // Skip parameters already resolved if (! empty($resolvedParameters)) { $parameters = array_diff_key($parameters, $resolvedParameters); } foreach ($parameters as $index => $parameter) { $parameterClass = $parameter->getClass(); if (!$parameterClass) { continue; } if ($parameterClass->name === 'Psr\Container\ContainerInterface') { $resolvedParameters[$index] = $this->container; } elseif ($parameterClass->name === 'DI\Factory\RequestedEntry') { // By convention the second parameter is the definition $resolvedParameters[$index] = $providedParameters[1]; } elseif ($this->container->has($parameterClass->name)) { $resolvedParameters[$index] = $this->container->get($parameterClass->name); } } return $resolvedParameters; } }