Completed
Pull Request — master (#8)
by Arnaud
02:50
created

AdminSubscriber::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace LAG\AdminBundle\Event\Subscriber;
4
5
use LAG\AdminBundle\Admin\Factory\AdminFactory;
6
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
7
use Symfony\Component\HttpKernel\Event\KernelEvent;
8
use Symfony\Component\HttpKernel\KernelEvents;
9
10
class AdminSubscriber implements EventSubscriberInterface
11
{
12
    /**
13
     * @var AdminFactory
14
     */
15
    protected $adminFactory;
16
17
    /**
18
     * @return array
19
     */
20
    public static function getSubscribedEvents()
21
    {
22
        return [
23
            KernelEvents::REQUEST => 'kernelRequest'
24
        ];
25
    }
26
27
    /**
28
     * AdminSubscriber constructor.
29
     *
30
     * @param AdminFactory $adminFactory
31
     */
32
    public function __construct(AdminFactory $adminFactory)
33
    {
34
        $this->adminFactory = $adminFactory;
35
    }
36
37
    /**
38
     * Init admin factory on kernel request.
39
     */
40
    public function kernelRequest()
41
    {
42
        // init admin factory
43
        $this->adminFactory->init();
44
    }
45
}
46