vendor/sylius/sylius/src/Sylius/Bundle/UiBundle/DataCollector/TraceableTemplateEventRenderer.php line 36

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Sylius package.
  4.  *
  5.  * (c) Paweł Jędrzejewski
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. declare(strict_types=1);
  11. namespace Sylius\Bundle\UiBundle\DataCollector;
  12. use Sylius\Bundle\UiBundle\Renderer\TemplateEventRendererInterface;
  13. /**
  14.  * @internal
  15.  * @experimental
  16.  */
  17. final class TraceableTemplateEventRenderer implements TemplateEventRendererInterface
  18. {
  19.     /** @var TemplateEventRendererInterface */
  20.     private $templateEventRenderer;
  21.     /** @var TemplateBlockRenderingHistory */
  22.     private $templateBlockRenderingHistory;
  23.     public function __construct(TemplateEventRendererInterface $templateEventRendererTemplateBlockRenderingHistory $templateBlockRenderingHistory)
  24.     {
  25.         $this->templateEventRenderer $templateEventRenderer;
  26.         $this->templateBlockRenderingHistory $templateBlockRenderingHistory;
  27.     }
  28.     public function render(array $eventNames, array $context = []): string
  29.     {
  30.         $this->templateBlockRenderingHistory->startRenderingEvent($eventNames$context);
  31.         $renderedEvent $this->templateEventRenderer->render($eventNames$context);
  32.         $this->templateBlockRenderingHistory->stopRenderingEvent($eventNames$context);
  33.         return $renderedEvent;
  34.     }
  35. }