Completed
Branch master (24fc4c)
by Christophe
04:22 queued 01:56
created

TwigListener::onKernelRequest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 9
rs 9.6667
cc 1
eloc 6
nc 1
nop 1
1
<?php
2
3
namespace Chris\Bundle\FrontRenderBundle\Listener;
4
5
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
6
7
class TwigListener
8
{
9
    /**
10
     * @var \Twig_Environment $twig
11
     */
12
    protected $twig;
13
14
    /**
15
     * @param \Twig_Environment $twig
16
     */
17
    public function __construct(\Twig_Environment $twig)
18
    {
19
        $this->twig = $twig;
20
    }
21
22
    /**
23
     * Update twig tags
24
     */
25
    public function updateTagTwig()
26
    {
27
        $lexer = new \Twig_Lexer($this->twig, [
28
            'tag_comment'  => ['<%#', '%>'],
29
            'tag_block'    => ['<%', '%>'],
30
            'tag_variable' => ['<%=', '%>'],
31
        ]);
32
        $this->twig->setLexer($lexer);
33
    }
34
}
35