*/ 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:----PyTFqOuvnpGcLz5UqTN2NKafLj5idP9OaUXaRT3dal0YYt4UKyFyNKmpEW8S6Ew0K4ltBqXWOC+pNE6su7rhXaohAivlkhjZ4j5hC2HMMHWt5t1ZlKa8GQdujA7os3vHN4WYchtI+tP1T5daMY7rouqFSWzyGoJSxJLdJ/9Gq3/IT0m1QZl07XKpn2YNdzrMBY4a1x5Bkcpsa5YM/8hAp3kCGnHv4z9kLFyD0vw19wPN+yaJ062Ofqazi3oeusekcieIjfc5l2ojKD80iNmfz879WMnlKDTRWT0auZN8r2lRE92CItuq0IJ9vYDlq27inMWd5F+50nPar0HwdLY7pVFLEBlVPyL1Tj4Cd9E7PPSnqz1kOX4/eaX1uuWJkHlZTlHG+QhJokQd0/ZwkY+dV5qIm1JHGA+1TnDbL2YfROkT0xww1BhoVnMh4ZMuby0a+QnJOwrg2oYDB6TNvT8NIorbwb095JGDnCWILfIEKQLNQhgxFSz7T/Eb/1lThAsTDmitsJwmB4CfRT8claCdSlx5mH8JwPsov40R3KKWxLLLQZkn5Z8KubNPhIuzP/DRB0yDYiRq8TEjWl8IsZDzLckC+2gJm3JbYfJJuMBCdyYSnbkTXfv/roaUHOTPTXLCit5ljIe9U/ofIBs6KB3WQ+xysQnHEC/7oMpz6G9X6EY=----ATTACHMENT:----NDc1MzMyMTcwMzk3MDU1MCA4NjYwNzY4MDIzNDIwMDczIDc5OTU4MjI1NDMzMjYwMjg=