Completed
Pull Request — dev (#6)
by Arnaud
07:28 queued 04:28
created

TemplateSubscriber   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getSubscribedEvents() 0 6 1
A kernelView() 0 4 1
1
<?php
2
3
namespace LAG\AdminBundle\Event\Subscriber;
4
5
use LAG\AdminBundle\Admin\Configuration\ApplicationConfiguration;
6
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
7
use Symfony\Component\HttpKernel\Event\KernelEvent;
8
use Symfony\Component\HttpKernel\KernelEvents;
9
use Twig_Environment;
10
11
class TemplateSubscriber implements EventSubscriberInterface
12
{
13
    /**
14
     * @var Twig_Environment
15
     */
16
    protected $twig;
17
18
    /**
19
     * @var ApplicationConfiguration
20
     */
21
    protected $configuration;
22
23
    public function __construct(Twig_Environment $twig, ApplicationConfiguration $configuration)
24
    {
25
        $this->twig = $twig;
26
        $this->configuration = $configuration;
27
    }
28
29
    public static function getSubscribedEvents()
30
    {
31
        return [
32
            KernelEvents::REQUEST => 'kernelView',
33
        ];
34
    }
35
36
    /**
37
     * @param KernelEvent $event
38
     *
39
     * @return null
40
     */
41
    public function kernelView(KernelEvent $event)
0 ignored issues
show
Unused Code introduced by
The parameter $event is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
42
    {
43
        $this->twig->addGlobal('config', $this->configuration);
44
    }
45
}
46