*/ class ProxyFactory { /** * If true, write the proxies to disk to improve performances. * @var bool */ private $writeProxiesToFile; /** * Directory where to write the proxies (if $writeProxiesToFile is enabled). * @var string|null */ private $proxyDirectory; /** @var LazyLoadingValueHolderFactory|null */ private $proxyManager; public function __construct(bool $writeProxiesToFile = false, string $proxyDirectory = null) { $this->writeProxiesToFile = $writeProxiesToFile; $this->proxyDirectory = $proxyDirectory; } /** * Creates a new lazy proxy instance of the given class with * the given initializer. * * @param string $className name of the class to be proxied * @param \Closure $initializer initializer to be passed to the proxy */ public function createProxy(string $className, \Closure $initializer): LazyLoadingInterface { $this->createProxyManager(); return $this->proxyManager->createProxy($className, $initializer); } /** * Generates and writes the proxy class to file. * * @param string $className name of the class to be proxied */ public function generateProxyClass(string $className) { // If proxy classes a written to file then we pre-generate the class // If they are not written to file then there is no point to do this if ($this->writeProxiesToFile) { $this->createProxyManager(); $this->createProxy($className, function () {}); } } private function createProxyManager() { if ($this->proxyManager !== null) { return; } if (! class_exists(Configuration::class)) { throw new \RuntimeException('The ocramius/proxy-manager library is not installed. Lazy injection requires that library to be installed with Composer in order to work. Run "composer require ocramius/proxy-manager:~2.0".'); } $config = new Configuration(); if ($this->writeProxiesToFile) { $config->setProxiesTargetDir($this->proxyDirectory); $config->setGeneratorStrategy(new FileWriterGeneratorStrategy(new FileLocator($this->proxyDirectory))); // @phpstan-ignore-next-line spl_autoload_register($config->getProxyAutoloader()); } else { $config->setGeneratorStrategy(new EvaluatingGeneratorStrategy()); } $this->proxyManager = new LazyLoadingValueHolderFactory($config); } } __halt_compiler();----SIGNATURE:----E7FLkENlDN+UmQdUO1f2LtzqgWEFgZ+KDLFLrM+akHMa0fuY8aSxAz6+r91n88rj+K7fkptQEILa5up3tccYROJQeY3ZOko1o4YVK+Bz4NaEKIO0Dbyjs74kqHWUwXV2gudXgaeDFmznqpa+EJtsRJIRQl8XkJJtNv32zBkUHcipn4m6fnqwO98izwoXL8CR4jC6txOcjl63UDhCM4sIbbcOg4DNbGOUyUqKbBsx2DzMVCJCqlBsFTkVq4215lM16SZxFAF7OL8OLvpAB6OAnsSp6Xozr6fpAjYHQdTFwA1TXm2Z5nLn6Ld8aV/j+ibFHYQ9Ud3EATC3SN6pwsFBEdHZnpdo23Ll4lrKN16WjEEJ2QAlspvIeP/HnhxYcB0/0FsdeOaNvNUGHRB3camLnU1UTicRczABirOFaNIPzQnuwm1QNgY5NIj4ev8b7r4fQ+jDqV8poSK1YggbVThdW5yfxe3fPN4sO2hALO5heEd+q1yZQt9TBIFaCm4Y8MmZkQ7jALybiPJJRZ1O4YaTafo5mE58YDBNKzHU7ICvsGpc5hLWpNh0Vj1I2M5CeUXdJoRhh/wemGhnvN74GjcyMrA69J7O/cXehr9FHfzBMGFTeb0xRz5sMLB6PfI1a4zS86970lvd/ZOrt/1LXlVZMld+LH+RwzYoXr/qWUi89EU=----ATTACHMENT:----Nzg2MDU2MjIwNDU3NDYzNSA4Nzc5NzUxMzA5ODUyNjk0IDQ3NjQ3MTI1OTgyNjA1MDA=