Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. LazyServiceInstantiator.php

class LazyServiceInstantiator

@author Nicolas Grekas <p@tchwork.com>

Hierarchy

  • class \Symfony\Component\DependencyInjection\LazyProxy\Instantiator\LazyServiceInstantiator implements \Symfony\Component\DependencyInjection\LazyProxy\Instantiator\InstantiatorInterface

Expanded class hierarchy of LazyServiceInstantiator

1 file declares its use of LazyServiceInstantiator
ContainerBuilder.php in vendor/symfony/dependency-injection/ContainerBuilder.php

File

vendor/symfony/dependency-injection/LazyProxy/Instantiator/LazyServiceInstantiator.php, line 22

Namespace

Symfony\Component\DependencyInjection\LazyProxy\Instantiator
View source
final class LazyServiceInstantiator implements InstantiatorInterface {
    public function instantiateProxy(ContainerInterface $container, Definition $definition, string $id, callable $realInstantiator) : object {
        $dumper = new LazyServiceDumper();
        if (!$dumper->isProxyCandidate($definition, $asGhostObject, $id)) {
            throw new InvalidArgumentException(\sprintf('Cannot instantiate lazy proxy for service "%s".', $id));
        }
        if (!class_exists($proxyClass = $dumper->getProxyClass($definition, $asGhostObject), false)) {
            eval($dumper->getProxyCode($definition, $id));
        }
        return $asGhostObject ? $proxyClass::createLazyGhost($realInstantiator) : $proxyClass::createLazyProxy($realInstantiator);
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
LazyServiceInstantiator::instantiateProxy public function Instantiates a proxy object. Overrides InstantiatorInterface::instantiateProxy
RSS feed
Powered by Drupal