1 | <?php |
||
14 | class Event implements EventInterface |
||
15 | { |
||
16 | /** |
||
17 | * The event name. |
||
18 | * |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $name; |
||
22 | |||
23 | /** |
||
24 | * The subject. |
||
25 | * |
||
26 | * @var object |
||
27 | */ |
||
28 | protected $subject; |
||
29 | |||
30 | /** |
||
31 | * Array of arguments. |
||
32 | * |
||
33 | * @var array |
||
34 | */ |
||
35 | protected $arguments = []; |
||
36 | |||
37 | /** |
||
38 | * Whether the propagation is stopped. |
||
39 | * |
||
40 | * @var boolean |
||
41 | */ |
||
42 | protected $propagationStopped = false; |
||
43 | |||
44 | public function __construct($name, $subject = null, array $arguments = []) |
||
50 | |||
51 | /** |
||
52 | * Gets the event name. |
||
53 | * |
||
54 | * @return string |
||
55 | */ |
||
56 | public function getName() |
||
60 | |||
61 | /** |
||
62 | * Sets the event name. |
||
63 | * |
||
64 | * @param $name |
||
65 | */ |
||
66 | public function setName($name) |
||
70 | |||
71 | /** |
||
72 | * Sets the subject. |
||
73 | * |
||
74 | * @param $subject |
||
75 | */ |
||
76 | public function setSubject($subject) |
||
80 | |||
81 | /** |
||
82 | * Gets the subject. |
||
83 | * |
||
84 | * @return null|object |
||
85 | */ |
||
86 | public function getSubject() |
||
90 | |||
91 | /** |
||
92 | * Sets a argument to the event. |
||
93 | * |
||
94 | * @param string $name |
||
95 | * @param mixed $value |
||
96 | */ |
||
97 | public function setArgument($name, $value) |
||
101 | |||
102 | /** |
||
103 | * Gets the argument by its key. |
||
104 | * |
||
105 | * @param string $name |
||
106 | * |
||
107 | * @return mixed |
||
108 | */ |
||
109 | public function getArgument($name) |
||
113 | |||
114 | /** |
||
115 | * Sets array of arguments. |
||
116 | * |
||
117 | * @param array $arguments |
||
118 | */ |
||
119 | public function setArguments(array $arguments) |
||
123 | |||
124 | /** |
||
125 | * Gets all arguments. |
||
126 | * |
||
127 | * @return array |
||
128 | */ |
||
129 | public function getArguments() |
||
133 | |||
134 | /** |
||
135 | * Stop event propagation. |
||
136 | * |
||
137 | * @return $this |
||
138 | */ |
||
139 | public function stopPropagation() |
||
145 | |||
146 | /** |
||
147 | * Checks whether propagation was stopped. |
||
148 | * |
||
149 | * @return bool |
||
150 | */ |
||
151 | public function isPropagationStopped() |
||
155 | } |
||
156 |