| Code Coverage
| Classes and Traits | Functions and Methods | Lines
Total |  | 100.00% | 1 / 1 |  | 100.00% | 2 / 2 | CRAP |  | 100.00% | 6 / 6
ControllerListener |  | 100.00% | 1 / 1 |  | 100.00% | 2 / 2 | 3 |  | 100.00% | 6 / 6
__construct(TemplateExtension $extension) |  | 100.00% | 1 / 1 | 1 |  | 100.00% | 2 / 2
onKernelController(FilterControllerEvent $event) |  | 100.00% | 1 / 1 | 2 |  | 100.00% | 4 / 4

1 | <?php
2 |
3 | namespace BodyRep\EventListener;
4 |
5 | use Symfony\Component\EventDispatcher\Event;
6 | use Symfony\Component\HttpKernel\HttpKernelInterface;
7 | use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
8 | use BodyRep\Twig\Extension\TemplateExtension;
9 |
10 | class ControllerListener
11 | {
12 | protected $extension;
13 |
14 | public function __construct(TemplateExtension $extension)
15 | {
16 | $this->extension = $extension;
17 | }
18 |
19 | public function onKernelController(FilterControllerEvent $event)
20 | {
21 |
22 | if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
23 | $this->extension->setController($event->getController());
24 | }
25 | }
26 | }