Completed
Push — master ( 9d8165...e9b726 )
by Cesar
28s queued 13s
created

KernelRequest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A onKernelRequest() 0 8 3
1
<?php
2
3
namespace App\EventListener;
4
5
use App\Service\AbstractSessionService;
0 ignored issues
show
Bug introduced by
The type App\Service\AbstractSessionService was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use App\Service\SettingsService;
7
use Symfony\Component\HttpKernel\Event\RequestEvent;
8
9
/**
10
 * Class KernelRequest
11
 * @package App\EventListener
12
 */
13
class KernelRequest
14
{
15
    /**
16
     * @var SettingsService
17
     */
18
    protected $settingsService;
19
20
    /**
21
     * SettingsService constructor.
22
     *
23
     * @param SettingsService $settingsService
24
     */
25
    public function __construct(SettingsService $settingsService)
26
    {
27
        $this->settingsService = $settingsService;
28
    }
29
30
    /**
31
     * @param RequestEvent $event
32
     */
33
    public function onKernelRequest(RequestEvent $event)
34
    {
35
        if (!$event->isMasterRequest()) {
36
            return;
37
        }
38
39
        if (!$this->settingsService->isInitialized()) {
40
            $this->settingsService->clearSettings();
41
        }
42
    }
43
}
44