return <<<EOF
if (true === \$lazyLoad) {
$instantiation \$container->createProxy('
$proxyClass', static fn () => \\
$proxyClass::createLazyGhost(
$factoryCode));
}
EOF;
} public function getProxyCode(Definition
$definition, string
$id = null
): string
{ if (!
$this->
isProxyCandidate($definition,
$asGhostObject,
$id)) { throw new InvalidArgumentException(sprintf('Cannot instantiate lazy proxy for service "%s".',
$id ??
$definition->
getClass()));
} $proxyClass =
$this->
getProxyClass($definition,
$asGhostObject,
$class);
if ($asGhostObject) { try { return 'class '.
$proxyClass.ProxyHelper::
generateLazyGhost($class);
} catch (LogicException
$e) { throw new InvalidArgumentException(sprintf('Cannot generate lazy ghost for service "%s".',
$id ??
$definition->
getClass()), 0,
$e);
} }