public function getProxyFactoryCode(Definition
$definition, string
$id, string
$factoryCode): string
{ $instantiation = 'return';
if ($definition->
isShared()) { $instantiation .=
sprintf(' $container->%s[%s] =',
$definition->
isPublic() && !
$definition->
isPrivate() ? 'services' : 'privates',
var_export($id, true
));
} $proxifiedClass =
new \
ReflectionClass($this->proxyGenerator->
getProxifiedClass($definition));
$proxyClass =
$this->
getProxyClassName($proxifiedClass->name
);
return <<<EOF
if (true === \$lazyLoad) {
$instantiation \$container->createProxy('
$proxyClass', static fn () => \\
$proxyClass::staticProxyConstructor(
static function (&\$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface \$proxy) use (\$container) {
\$wrappedInstance =
$factoryCode;
\$proxy->setProxyInitializer(null);
return true;
}
));
}