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

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.  *
  16.  * @experimental
  17.  */
  18. final class TraceableTemplateEventRenderer implements TemplateEventRendererInterface
  19. {
  20.     public function __construct(
  21.         private TemplateEventRendererInterface $templateEventRenderer,
  22.         private TemplateBlockRenderingHistory $templateBlockRenderingHistory,
  23.     ) {
  24.     }
  25.     public function render(array $eventNames, array $context = []): string
  26.     {
  27.         $this->templateBlockRenderingHistory->startRenderingEvent($eventNames$context);
  28.         $renderedEvent $this->templateEventRenderer->render($eventNames$context);
  29.         $this->templateBlockRenderingHistory->stopRenderingEvent($eventNames$context);
  30.         return $renderedEvent;
  31.     }
  32. }