*/ class ResolverDispatcher implements DefinitionResolver { /** @var ContainerInterface */ private $container; /** @var ProxyFactory */ private $proxyFactory; private $arrayResolver; private $factoryResolver; private $decoratorResolver; private $objectResolver; private $instanceResolver; private $envVariableResolver; public function __construct(ContainerInterface $container, ProxyFactory $proxyFactory) { $this->container = $container; $this->proxyFactory = $proxyFactory; } /** * Resolve a definition to a value. * * @param Definition $definition Object that defines how the value should be obtained. * @param array $parameters Optional parameters to use to build the entry. * * @throws InvalidDefinition If the definition cannot be resolved. * * @return mixed Value obtained from the definition. */ public function resolve(Definition $definition, array $parameters = []) { // Special case, tested early for speed if ($definition instanceof SelfResolvingDefinition) { return $definition->resolve($this->container); } $definitionResolver = $this->getDefinitionResolver($definition); return $definitionResolver->resolve($definition, $parameters); } public function isResolvable(Definition $definition, array $parameters = []): bool { // Special case, tested early for speed if ($definition instanceof SelfResolvingDefinition) { return $definition->isResolvable($this->container); } $definitionResolver = $this->getDefinitionResolver($definition); return $definitionResolver->isResolvable($definition, $parameters); } /** * Returns a resolver capable of handling the given definition. * * @throws \RuntimeException No definition resolver was found for this type of definition. */ private function getDefinitionResolver(Definition $definition): DefinitionResolver { switch (true) { case $definition instanceof ObjectDefinition: if (! $this->objectResolver) { $this->objectResolver = new ObjectCreator($this, $this->proxyFactory); } return $this->objectResolver; case $definition instanceof DecoratorDefinition: if (! $this->decoratorResolver) { $this->decoratorResolver = new DecoratorResolver($this->container, $this); } return $this->decoratorResolver; case $definition instanceof FactoryDefinition: if (! $this->factoryResolver) { $this->factoryResolver = new FactoryResolver($this->container, $this); } return $this->factoryResolver; case $definition instanceof ArrayDefinition: if (! $this->arrayResolver) { $this->arrayResolver = new ArrayResolver($this); } return $this->arrayResolver; case $definition instanceof EnvironmentVariableDefinition: if (! $this->envVariableResolver) { $this->envVariableResolver = new EnvironmentVariableResolver($this); } return $this->envVariableResolver; case $definition instanceof InstanceDefinition: if (! $this->instanceResolver) { $this->instanceResolver = new InstanceInjector($this, $this->proxyFactory); } return $this->instanceResolver; default: throw new \RuntimeException('No definition resolver was configured for definition of type ' . get_class($definition)); } } } __halt_compiler();----SIGNATURE:----GMhnvJHdWwnH3qgojT9tdlwuA/rIoN9xA6gm5ycxk9L/AJGNi/b6lK8/HZWlSjq0ybUZBuAEYF0zAgOz364w1ccWCksTFP6eVM0ZV2TM04fVR8HhQ+uPSgB8zgbFLSpYBTBrC2MnriF2hE8zKT6fc9RsxI9cnFyRvrXDjf6L8g79CTtKY4BLqaRSu2MOw+5enwV5qzbXIsdzVf3faAmxKKUQsq5LiZhR8HOyJ9I5jpuRNVU6IYSZo5C+JYHysI1O4/gIBdDSmQw/7DPSisRc0FrPSWw50+OzeZcSUzUITva4y40ttDlVhb/ch1Ijk3G+6F357KObMpqfZyOZWyx0TCRZQpDgWG3PyB9od1fD0Cu9V7SY/G59shERveSh7s7hB5wdtn0pHQoZhjIVG8u0RxdFp90QlYhRQ21pftZgpknmH1dtHObLh5wwFnfQbQL61Yq4CYHQY2qqziKWxIB7OtDqylB3O8OsyFniRhRY36K2EaTHSuubmcSIm5790RvKsVEuE2bFO4stbp6phxKAqhBMAo/XA7WZOEpFGeDOCns8PUUazfhQnzPvxCAJ8eV59oY3R0qXhHk4TEKnB/og2s78iOCGOFH8/VAS0EyF4Gt32l/xjqpGtKYRM1FdVOA8VSrnF12hv7XB9vzluSVUlVv7Korq2GTDTPJGlRBFTU0=----ATTACHMENT:----Nzc2MjM5NzM1Mzg1NDUyOCA3NTMxNTUxOTA3ODQzODA0IDIyMDY2OTk4MDM3ODcxMTI=