*/ 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:----rwdluQd7zqRIZJeq3/Dw6X71KVQy3dXU5Js3z/g79zBqyJGDFL/q4FEHZibRhdh/pUwcRO3SX62UwI3Sa2XJ0PmbCydrJIoLjW+mj1Yzf6ukrx0e85Vyu7BRSFu2mG/sbtdsv5MlC03/YN1zThU/Y2iOA7EP+iV3p7KtzbwbzjWdyZsbtH+S6ojEF8XseQQJHMxz5qRIK+JRHOulS9IFLStnGtjd85Stuya05YL1DA6UlOsu6Pg53wLt4kpZBiDzGF6/Toai24WVzs5Z0A2/mY16lb5/6B2zzdnp6rPyBDZ2HoS+U4w/mswHeSpFyoPo8Ohzfnq6tbMxS4rfqFmSmWBWhh+JteidTOEj6KZZAlRNRnonNphxcDpeM2EXdzvRtzrpzXV+JEcKZ2hvlwioH69AzRwb296M6KmfC8KrxzfQM8035+r/Oddw95h5fj3nzoEwakT7TdsNvIg3RVA/WvOunG2JDmMP6Nj/4dxS4euBsh9yLOi9kIl25itTYnNsoRqRiyZolnbjjQn8Z6E54YU37gcbHF50Xifea58r2b3m7kxWjtTu4Ps2I7aYR/REfhmbfi+ZMHb5TQ418qLFJtHZvbwHgHzthj40lGOn69C30z5GrfORM0AHuwGs3ZtV/7rfMTRaHp4Zx27bXH6REjD2D0QEYbv66vSbQNjn9cM=----ATTACHMENT:----NzY3NjAwODg4MjA1OTgzNSA0NDQ2MzU5OTk2MzIxNzkzIDIxMjYyMjUwMTYxNjk4NjM=