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

Breadcrumb

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

function LazyServiceInstantiator::instantiateProxy

Overrides InstantiatorInterface::instantiateProxy

File

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

Class

LazyServiceInstantiator
@author Nicolas Grekas <p@tchwork.com>

Namespace

Symfony\Component\DependencyInjection\LazyProxy\Instantiator

Code

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);
}
RSS feed
Powered by Drupal