[ Index ] |
PHP Cross Reference of phpBB-3.3.14-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\Component\HttpKernel\DependencyInjection; 13 14 use Psr\Container\ContainerInterface; 15 use Symfony\Component\HttpFoundation\RequestStack; 16 use Symfony\Component\HttpKernel\Fragment\FragmentHandler; 17 18 /** 19 * Lazily loads fragment renderers from the dependency injection container. 20 * 21 * @author Fabien Potencier <fabien@symfony.com> 22 */ 23 class LazyLoadingFragmentHandler extends FragmentHandler 24 { 25 private $container; 26 /** 27 * @deprecated since version 3.3, to be removed in 4.0 28 */ 29 private $rendererIds = []; 30 private $initialized = []; 31 32 /** 33 * @param ContainerInterface $container A container 34 * @param RequestStack $requestStack The Request stack that controls the lifecycle of requests 35 * @param bool $debug Whether the debug mode is enabled or not 36 */ 37 public function __construct(ContainerInterface $container, RequestStack $requestStack, $debug = false) 38 { 39 $this->container = $container; 40 41 parent::__construct($requestStack, [], $debug); 42 } 43 44 /** 45 * Adds a service as a fragment renderer. 46 * 47 * @param string $name The service name 48 * @param string $renderer The render service id 49 * 50 * @deprecated since version 3.3, to be removed in 4.0 51 */ 52 public function addRendererService($name, $renderer) 53 { 54 @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED); 55 56 $this->rendererIds[$name] = $renderer; 57 } 58 59 /** 60 * {@inheritdoc} 61 */ 62 public function render($uri, $renderer = 'inline', array $options = []) 63 { 64 // BC 3.x, to be removed in 4.0 65 if (isset($this->rendererIds[$renderer])) { 66 $this->addRenderer($this->container->get($this->rendererIds[$renderer])); 67 unset($this->rendererIds[$renderer]); 68 69 return parent::render($uri, $renderer, $options); 70 } 71 72 if (!isset($this->initialized[$renderer]) && $this->container->has($renderer)) { 73 $this->addRenderer($this->container->get($renderer)); 74 $this->initialized[$renderer] = true; 75 } 76 77 return parent::render($uri, $renderer, $options); 78 } 79 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Nov 25 19:05:08 2024 | Cross-referenced by PHPXref 0.7.1 |