CardRouteListener   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A onKernelRequest() 0 12 4
1
<?php
2
3
namespace App\EventListener;
4
5
use Symfony\Component\HttpKernel\Event\RequestEvent;
6
use App\Model\FrenchSuitedDeck;
7
8
class CardRouteListener
9
{
10
    public function onKernelRequest(RequestEvent $event): void
11
    {
12
13
        $request = $event->getRequest();
14
        $session = $request->getSession();
15
16
        $attributes = $request->attributes->get('_route_params');
17
18
        if ($attributes && key_exists('deck_needed', $attributes)) {
19
            if (!$session->has('deck_2')) {
20
                $frenchDeck = FrenchSuitedDeck::create();
21
                $session->set('deck_2', $frenchDeck->getDeck());
22
            }
23
        }
24
    }
25
}
26