BroadcastableEvent   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 59
ccs 0
cts 28
cp 0
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setOriginName() 0 4 1
A getOriginName() 0 4 1
A getSubject() 0 6 1
A getAction() 0 6 1
A setBroadcasted() 0 4 1
A isBroadcasted() 0 4 1
1
<?php
2
3
namespace Majora\Framework\Event;
4
5
use Symfony\Component\EventDispatcher\Event;
6
7
/**
8
 * Simple implementation of BroadcastableEventInterface.
9
 */
10
class BroadcastableEvent extends Event implements BroadcastableEventInterface
11
{
12
    private $originName;
13
    private $isBroadcasted = false;
14
15
    /**
16
     * @see BroadcastableEventInterface::setOriginName()
17
     */
18
    public function setOriginName($originName)
19
    {
20
        $this->originName = $originName;
21
    }
22
23
    /**
24
     * return original name.
25
     *
26
     * @return string
27
     */
28
    public function getOriginName()
29
    {
30
        return $this->originName;
31
    }
32
33
    /**
34
     * @see BroadcastableEventInterface::getSubject()
35
     */
36
    public function getSubject()
37
    {
38
        throw new \BadMethodCallException(sprintf('%s::getSubject() has to be implemented.',
39
            get_class($this)
40
        ));
41
    }
42
43
    /**
44
     * @see BroadcastableEventInterface::getAction()
45
     */
46
    public function getAction()
47
    {
48
        throw new \BadMethodCallException(sprintf('%s::getAction() has to be implemented.',
49
            get_class($this)
50
        ));
51
    }
52
53
    /**
54
     * @see BroadcastableEventInterface::setBroadcasted()
55
     */
56
    public function setBroadcasted($broadcasted)
57
    {
58
        $this->isBroadcasted = !empty($broadcasted);
59
    }
60
61
    /**
62
     * @see BroadcastableEventInterface::isBroadcasted()
63
     */
64
    public function isBroadcasted()
65
    {
66
        return !empty($this->isBroadcasted);
67
    }
68
}
69