* @license MIT */ class LazyLoadingValueHolderFactory extends AbstractBaseFactory { /** * @var \ProxyManager\ProxyGenerator\LazyLoadingValueHolderGenerator|null */ private $generator; public function createProxy( string $className, \Closure $initializer, array $proxyOptions = [] ) : VirtualProxyInterface { $proxyClassName = $this->generateProxy($className, $proxyOptions); return $proxyClassName::staticProxyConstructor($initializer); } /** * {@inheritDoc} */ protected function getGenerator() : ProxyGeneratorInterface { return $this->generator ?: $this->generator = new LazyLoadingValueHolderGenerator(); } }