LazyLoadingFragmentHandler.php in Zircon Profile 8.0
File
vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php
View source
<?php
namespace Symfony\Component\HttpKernel\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
class LazyLoadingFragmentHandler extends FragmentHandler {
private $container;
private $rendererIds = array();
public function __construct(ContainerInterface $container, $debug = false, RequestStack $requestStack = null) {
$this->container = $container;
parent::__construct(array(), $debug, $requestStack);
}
public function addRendererService($name, $renderer) {
$this->rendererIds[$name] = $renderer;
}
public function render($uri, $renderer = 'inline', array $options = array()) {
if (isset($this->rendererIds[$renderer])) {
$this
->addRenderer($this->container
->get($this->rendererIds[$renderer]));
unset($this->rendererIds[$renderer]);
}
return parent::render($uri, $renderer, $options);
}
}