DecodeControllerParametersSubscriber   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 24
ccs 10
cts 10
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getDecodeControllerParameters() 0 3 1
A onKernelController() 0 3 1
A getSubscribedEvents() 0 4 1
1
<?php
2
3
namespace Pgs\HashIdBundle\EventSubscriber;
4
5
use Pgs\HashIdBundle\Service\DecodeControllerParameters;
6
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
7
use Symfony\Component\HttpKernel\Event\ControllerEvent;
8
use Symfony\Component\HttpKernel\KernelEvents;
9
10
class DecodeControllerParametersSubscriber implements EventSubscriberInterface
11
{
12
    protected $decodeControllerParameters;
13
14 1
    public function __construct(DecodeControllerParameters $decodeControllerParameters)
15
    {
16 1
        $this->decodeControllerParameters = $decodeControllerParameters;
17 1
    }
18
19 1
    public function onKernelController(ControllerEvent $event): void
20
    {
21 1
        $this->getDecodeControllerParameters()->decodeControllerParameters($event);
22 1
    }
23
24 2
    public static function getSubscribedEvents(): array
25
    {
26
        return [
27 2
            KernelEvents::CONTROLLER => 'onKernelController',
28
        ];
29
    }
30
31 1
    public function getDecodeControllerParameters(): DecodeControllerParameters
32
    {
33 1
        return $this->decodeControllerParameters;
34
    }
35
}
36