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

TwigListener   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 2
c 2
b 0
f 1
lcom 1
cbo 2
dl 0
loc 28
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A updateTagTwig() 0 9 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