[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 * This file is part of the Symfony package. 5 * 6 * (c) Fabien Potencier <fabien@symfony.com> 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12 namespace Symfony\Bridge\ProxyManager\LazyProxy\Instantiator; 13 14 use ProxyManager\Configuration; 15 use ProxyManager\Factory\LazyLoadingValueHolderFactory; 16 use ProxyManager\GeneratorStrategy\EvaluatingGeneratorStrategy; 17 use ProxyManager\Proxy\LazyLoadingInterface; 18 use Symfony\Component\DependencyInjection\ContainerInterface; 19 use Symfony\Component\DependencyInjection\Definition; 20 use Symfony\Component\DependencyInjection\LazyProxy\Instantiator\InstantiatorInterface; 21 22 /** 23 * Runtime lazy loading proxy generator. 24 * 25 * @author Marco Pivetta <ocramius@gmail.com> 26 */ 27 class RuntimeInstantiator implements InstantiatorInterface 28 { 29 /** 30 * @var LazyLoadingValueHolderFactory 31 */ 32 private $factory; 33 34 public function __construct() 35 { 36 $config = new Configuration(); 37 $config->setGeneratorStrategy(new EvaluatingGeneratorStrategy()); 38 39 if (method_exists('ProxyManager\Version', 'getVersion')) { 40 $this->factory = new LazyLoadingValueHolderFactoryV2($config); 41 } else { 42 $this->factory = new LazyLoadingValueHolderFactoryV1($config); 43 } 44 } 45 46 /** 47 * {@inheritdoc} 48 */ 49 public function instantiateProxy(ContainerInterface $container, Definition $definition, $id, $realInstantiator) 50 { 51 return $this->factory->createProxy( 52 $definition->getClass(), 53 function (&$wrappedInstance, LazyLoadingInterface $proxy) use ($realInstantiator) { 54 $wrappedInstance = \call_user_func($realInstantiator); 55 56 $proxy->setProxyInitializer(null); 57 58 return true; 59 } 60 ); 61 } 62 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |