NotificationSubscriber   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 41
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getSubscribedEvents() 0 6 1
A notify() 0 4 1
A getNotifications() 0 4 1
A clearNotifications() 0 4 1
1
<?php
2
3
namespace JK\SamBundle\Event\Subscriber;
4
5
use JK\Sam\Event\NotificationEvent;
6
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
7
8
class NotificationSubscriber implements EventSubscriberInterface
9
{
10
    /**
11
     * @var array
12
     */
13
    protected $notifications = [];
14
15
    /**
16
     * @return array
17
     */
18 1
    public static function getSubscribedEvents()
19
    {
20
        return [
21 1
            NotificationEvent::NAME => 'notify'
22
        ];
23
    }
24
25
    /**
26
     * @param NotificationEvent $event
27
     */
28 1
    public function notify(NotificationEvent $event)
29
    {
30 1
        $this->notifications[] = $event->getMessage();
31 1
    }
32
33
    /**
34
     * @return array
35
     */
36 1
    public function getNotifications()
37
    {
38 1
        return $this->notifications;
39
    }
40
41
    /**
42
     * 
43
     */
44 1
    public function clearNotifications()
45
    {
46 1
        $this->notifications = [];
47 1
    }
48
}
49