Event   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getName() 0 4 1
A __get() 0 8 2
A setSubject() 0 4 1
A getSubject() 0 4 1
1
<?php
2
3
namespace Knp\RadBundle\DomainEvent;
4
5
use Symfony\Component\EventDispatcher\Event as BaseEvent;
6
7
class Event extends BaseEvent
8
{
9
    private $eventName;
10
    private $properties;
11
    private $subject;
12
13
    public function __construct($eventName, array $properties = array())
14
    {
15
        $this->eventName = $eventName;
16
        $this->properties = $properties;
17
    }
18
19
    public function getName()
20
    {
21
        return $this->eventName;
22
    }
23
24
    public function __get($name)
25
    {
26
        if (!array_key_exists($name, $this->properties)) {
27
            throw new \RuntimeException("Property '$name' does not exist on event '{$this->eventName}'");
28
        }
29
30
        return $this->properties[$name];
31
    }
32
33
    public function setSubject(Provider $subject)
34
    {
35
        $this->subject = $subject;
36
    }
37
38
    public function getSubject()
39
    {
40
        return $this->subject;
41
    }
42
}
43