src/Template/TemplateUtil.php
public function renderTwigTemplate(string $name, array $context = [])
    {
        $event = $this->container->get('event_dispatcher')->dispatch(
            RenderTwigTemplateEvent::NAME,
            new RenderTwigTemplateEvent(
                $name, $context
            )
        );

        $buffer = $this->container->get('twig')->render(
            $this->getTemplate($event->getTemplate()),
            $event->getContext()
        );

        return $buffer;
    }
public function renderTwigTemplate(string $name, array $context = [])
    {
        $event = $this->container->get('event_dispatcher')->dispatch(
            RenderTwigTemplateEvent::NAME,
            new RenderTwigTemplateEvent(
                $name, $context
            )
        );

        $buffer = $this->container->get('twig')->render(
            $this->getTemplate($event->getTemplate()),
            $event->getContext()
        );

        return $buffer;
    }
public function renderTwigTemplate ( string $ name , array $ context = [ ] ) { $ event = $ this -> container -> get ( 'event_dispatcher' ) -> dispatch ( RenderTwigTemplateEvent :: NAME , new RenderTwigTemplateEvent ( $ name , $ context ) ) ; $ buffer = $ this -> container -> get ( 'twig' ) -> render ( $ this -> getTemplate ( $ event -> getTemplate ( ) ) , $ event -> getContext ( ) ) ; return $ buffer ; }
Renders a twig template with data.

@param string $name    The twig template name
@param array  $context The twig template context data

@throws \Psr\Cache\InvalidArgumentException
@throws \Twig_Error_Loader
@throws \Twig_Error_Runtime
@throws \Twig_Error_Syntax

@return string
Renders a twig template with data .