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
));
} $asGhostObject =
str_contains($factoryCode, '$proxy'
);
$proxyClass =
$this->
getProxyClass($definition,
$asGhostObject);
if (!
$asGhostObject) { return <<<EOF
if (true === \$lazyLoad) {
$instantiation \$container->createProxy('
$proxyClass', static fn () => \\
$proxyClass::createLazyProxy(static fn () =>
$factoryCode));
}
EOF;
}