Completed
Push — master ( b15ea3...332a47 )
by WEBEWEB
01:49
created

NotificationEventListener   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 36
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A onNotify() 0 3 1
1
<?php
2
3
/**
4
 * This file is part of the bootstrap-bundle package.
5
 *
6
 * (c) 2018 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Bundle\BootstrapBundle\EventListener;
13
14
use WBW\Bundle\BootstrapBundle\Event\NotificationEvent;
15
16
/**
17
 * Notification event listener.
18
 *
19
 * @author webeweb <https://github.com/webeweb/>
20
 * @package WBW\Bundle\BootstrapBundle\EventListener
21
 */
22
class NotificationEventListener {
23
24
    /**
25
     * Service name.
26
     *
27
     * @var string
28
     */
29
    const SERVICE_NAME = "webeweb.bundle.bootstrapbundle.eventlistener.notification";
30
31
    /**
32
     * Kernel event listener.
33
     *
34
     * @var KernelEventListener
35
     */
36
    private $kernelEventListener;
37
38
    /**
39
     * Constructor.
40
     *
41
     * @param KernelEventListener $kernelEventListener The kernel event listener.
42
     */
43
    public function __construct(KernelEventListener $kernelEventListener) {
44
        $this->kernelEventListener = $kernelEventListener;
45
    }
46
47
    /**
48
     * On notify.
49
     *
50
     * @param NotificationEvent $event The notification event.
51
     * @return void
52
     */
53
    public function onNotify(NotificationEvent $event) {
54
        $this->kernelEventListener->getRequest()->getSession()->getFlashBag()->add($event->getType(), $event->getNotification());
55
    }
56
57
}
58