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

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.     private TemplateEventRendererInterface $templateEventRenderer;
  20.     private TemplateBlockRenderingHistory $templateBlockRenderingHistory;
  21.     public function __construct(TemplateEventRendererInterface $templateEventRendererTemplateBlockRenderingHistory $templateBlockRenderingHistory)
  22.     {
  23.         $this->templateEventRenderer $templateEventRenderer;
  24.         $this->templateBlockRenderingHistory $templateBlockRenderingHistory;
  25.     }
  26.     public function render(array $eventNames, array $context = []): string
  27.     {
  28.         $this->templateBlockRenderingHistory->startRenderingEvent($eventNames$context);
  29.         $renderedEvent $this->templateEventRenderer->render($eventNames$context);
  30.         $this->templateBlockRenderingHistory->stopRenderingEvent($eventNames$context);
  31.         return $renderedEvent;
  32.     }
  33. }