1 | <?php |
||
8 | class DomainEvent implements Message |
||
9 | { |
||
10 | /** |
||
11 | * @var string |
||
12 | */ |
||
13 | protected $origin; |
||
14 | |||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | protected $name; |
||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $version; |
||
24 | |||
25 | /** |
||
26 | * @var int |
||
27 | */ |
||
28 | protected $occurredOn; |
||
29 | |||
30 | /** |
||
31 | * @var array|null |
||
32 | */ |
||
33 | protected $extraAttributes; |
||
34 | |||
35 | /** |
||
36 | * @var array |
||
37 | */ |
||
38 | protected $body = array(); |
||
39 | |||
40 | /** |
||
41 | * @var string |
||
42 | */ |
||
43 | private $id; |
||
44 | |||
45 | /** |
||
46 | * @var bool |
||
47 | */ |
||
48 | protected $isDeprecated = false; |
||
49 | |||
50 | /** |
||
51 | * @var string|null |
||
52 | */ |
||
53 | protected $correlationId; |
||
54 | |||
55 | /** |
||
56 | * @param string $origin |
||
57 | * @param string $name |
||
58 | * @param string $version |
||
59 | * @param int $occurredOn |
||
60 | * @param array $body |
||
61 | * @param string $id |
||
62 | * @param bool $isDeprecated |
||
63 | * @param string|null $correlationId |
||
64 | * @param array|null $extraAttributes |
||
65 | * @throws DomainEventException |
||
66 | */ |
||
67 | public function __construct( |
||
89 | |||
90 | /** |
||
91 | * @return string |
||
92 | */ |
||
93 | public function getOrigin() |
||
97 | |||
98 | /** |
||
99 | * @return string |
||
100 | */ |
||
101 | public function getName() |
||
105 | |||
106 | /** |
||
107 | * @return string |
||
108 | */ |
||
109 | public function getVersion() |
||
113 | |||
114 | /** |
||
115 | * Timestamp |
||
116 | * |
||
117 | * @return int |
||
118 | */ |
||
119 | public function getOccurredOn() |
||
123 | |||
124 | /** |
||
125 | * @return array|null |
||
126 | */ |
||
127 | public function getExtraAttributes() |
||
131 | |||
132 | /** |
||
133 | * @return array |
||
134 | */ |
||
135 | public function getBody() |
||
139 | |||
140 | /** |
||
141 | * @return int |
||
142 | */ |
||
143 | public function getDelay() |
||
147 | |||
148 | /** |
||
149 | * @return string |
||
150 | */ |
||
151 | public function getID() |
||
155 | |||
156 | /** |
||
157 | * @return bool |
||
158 | */ |
||
159 | public function isDeprecated() |
||
163 | |||
164 | /** |
||
165 | * @return string|null |
||
166 | */ |
||
167 | public function getCorrelationID() |
||
171 | |||
172 | /** |
||
173 | * @param string $key |
||
174 | * @param mixed $default |
||
175 | * |
||
176 | * @return mixed |
||
177 | */ |
||
178 | public function getBodyValue($key, $default = null) |
||
186 | |||
187 | /** |
||
188 | * @param string $key |
||
189 | * |
||
190 | * @return mixed |
||
191 | * |
||
192 | * @throws DomainEventException |
||
193 | */ |
||
194 | public function getBodyValueOrFail($key) |
||
202 | |||
203 | /** |
||
204 | * @param string $origin |
||
205 | * @return DomainEvent $this |
||
206 | * @throws DomainEventException |
||
207 | */ |
||
208 | protected function setOrigin($origin) |
||
217 | |||
218 | /** |
||
219 | * @param string $name |
||
220 | * @return DomainEvent $this |
||
221 | * @throws DomainEventException |
||
222 | */ |
||
223 | protected function setName($name) |
||
232 | |||
233 | /** |
||
234 | * @param string $version |
||
235 | * @return DomainEvent $this |
||
236 | * @throws DomainEventException |
||
237 | */ |
||
238 | protected function setVersion($version) |
||
247 | |||
248 | /** |
||
249 | * @param int $occurredOn |
||
250 | * @return DomainEvent $this |
||
251 | * @throws DomainEventException |
||
252 | */ |
||
253 | protected function setOccurredOn($occurredOn) |
||
267 | |||
268 | /** |
||
269 | * @param array|null $extraAttributes |
||
270 | */ |
||
271 | protected function setExtraAttributes($extraAttributes) |
||
275 | |||
276 | /** |
||
277 | * @return array |
||
278 | */ |
||
279 | public function jsonSerialize() |
||
293 | } |
||
294 |