*/ class FactoryResolver implements DefinitionResolver { /** @var ContainerInterface */ private $container; /** @var Invoker|null */ private $invoker; /** @var DefinitionResolver */ private $resolver; /** * The resolver needs a container. This container will be passed to the factory as a parameter * so that the factory can access other entries of the container. */ public function __construct(ContainerInterface $container, DefinitionResolver $resolver) { $this->container = $container; $this->resolver = $resolver; } /** * Resolve a factory definition to a value. * * This will call the callable of the definition. * * @param FactoryDefinition $definition */ public function resolve(Definition $definition, array $parameters = []) { if (! $this->invoker) { $parameterResolver = new ResolverChain([ new AssociativeArrayResolver, new FactoryParameterResolver($this->container), new NumericArrayResolver, new DefaultValueResolver, ]); $this->invoker = new Invoker($parameterResolver, $this->container); } $callable = $definition->getCallable(); try { $providedParams = [$this->container, $definition]; $extraParams = $this->resolveExtraParams($definition->getParameters()); $providedParams = array_merge($providedParams, $extraParams, $parameters); return $this->invoker->call($callable, $providedParams); } catch (NotCallableException $e) { // Custom error message to help debugging if (is_string($callable) && class_exists($callable) && method_exists($callable, '__invoke')) { throw new InvalidDefinition(sprintf( 'Entry "%s" cannot be resolved: factory %s. Invokable classes cannot be automatically resolved if autowiring is disabled on the container, you need to enable autowiring or define the entry manually.', $definition->getName(), $e->getMessage() )); } throw new InvalidDefinition(sprintf( 'Entry "%s" cannot be resolved: factory %s', $definition->getName(), $e->getMessage() )); } catch (NotEnoughParametersException $e) { throw new InvalidDefinition(sprintf( 'Entry "%s" cannot be resolved: %s', $definition->getName(), $e->getMessage() )); } } public function isResolvable(Definition $definition, array $parameters = []): bool { return true; } private function resolveExtraParams(array $params): array { $resolved = []; foreach ($params as $key => $value) { // Nested definitions if ($value instanceof Definition) { $value = $this->resolver->resolve($value); } $resolved[$key] = $value; } return $resolved; } } __halt_compiler();----SIGNATURE:----AninFDoVHVX4vkkI7QzK+cz6hJhlqQRZx+SuK9d2AzZ0Zt9FPy+pY9Jgc94k+yzJAWYT+P3h2EP6rfhhX81pQ3Wg/WI5wP4bNO0HkAn2IXug2IZ/ndsSUz+TsgtS4qLcI/mw0JACzoX7qPqZik6yewAIXpPvwnXRHyQMTGi+NE4AMYV2JGEvIfzobsT9vK6QO9DN8rc/GJRG1OUROQ+LxQffIzhOtSMCt9M89mXBfImfGumvpRpHVaoN+hXNjoAeKJAhAJtprhBLXMoc0kDsjKAZNYcDaG7OByH764jjsW6S1DAskWwrXG/sr6CRppfmBxl/q6r9kTFPrMSF+g8I63k2EFjDvCZ9NUNOxEDK51lHcWJn/AOtJKVo7nPZ9jyu6qyvZEnUe8NRkzCT/0gTACGUSyldTd9AGuvAYIEShWaPhwQ5SIMMkQFaPakdrESFLRL3UJTKT/eranem+ldPxYrv2J0/dRoRL1TO/9H35inbpcalZL1CtQ15b58RwGiF1kHOq35PGAVRv/FctjU0iqNAvch5Et5w0SE5KhwP4cUQs4kfHpKI2GmHNP9WWjxRbN98dvcHyriyzWcpoH2lg3X7V+0lb9ctDEVXT4uE8aMn7kFMtX38A783PrMOE7mAiYNiWY2zMuIZhmbaVGDgN8q9Kn47KLeao2f8JnxiVpY=----ATTACHMENT:----NDU4NDk1NTkxMDE4ODcxIDYyNzIxNTQ2ODc0MjExMTIgNzI5MjA2OTAwMDMwNjkyMw==