BroadcastableEvent::getSubject()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
ccs 0
cts 6
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 2
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