1 | <?php |
||
7 | class DomainEvent implements Message |
||
8 | { |
||
9 | /** |
||
10 | * @var string |
||
11 | */ |
||
12 | protected $origin; |
||
13 | |||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | protected $name; |
||
18 | |||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $version; |
||
23 | |||
24 | /** |
||
25 | * @var int |
||
26 | */ |
||
27 | protected $occurredOn; |
||
28 | |||
29 | /** |
||
30 | * @var array |
||
31 | */ |
||
32 | protected $body = array(); |
||
33 | |||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | private $id; |
||
38 | |||
39 | /** |
||
40 | * @var bool |
||
41 | */ |
||
42 | protected $isDeprecated = false; |
||
43 | |||
44 | /** |
||
45 | * @var string|null |
||
46 | */ |
||
47 | protected $correlationId; |
||
48 | |||
49 | /** |
||
50 | * @var array |
||
51 | */ |
||
52 | private $attributes; |
||
53 | |||
54 | /** |
||
55 | * @var string |
||
56 | */ |
||
57 | private $context; |
||
58 | |||
59 | /** |
||
60 | * @param string $origin |
||
61 | * @param string $name |
||
62 | * @param string $version |
||
63 | * @param int $occurredOn |
||
64 | * @param array $body |
||
65 | * @param string $id |
||
66 | * @param bool $isDeprecated |
||
67 | * @param string|null $correlationId |
||
68 | * @param array $attributes |
||
69 | * @param string $context |
||
70 | * @throws DomainEventException |
||
71 | */ |
||
72 | public function __construct( |
||
96 | |||
97 | /** |
||
98 | * @return string |
||
99 | */ |
||
100 | public function getOrigin() |
||
104 | |||
105 | /** |
||
106 | * @return string |
||
107 | */ |
||
108 | public function getName() |
||
112 | |||
113 | /** |
||
114 | * @return string |
||
115 | */ |
||
116 | public function getVersion() |
||
120 | |||
121 | /** |
||
122 | * Timestamp |
||
123 | * |
||
124 | * @return int |
||
125 | */ |
||
126 | public function getOccurredOn() |
||
130 | |||
131 | /** |
||
132 | * @return array |
||
133 | */ |
||
134 | public function getBody() |
||
138 | |||
139 | /** |
||
140 | * @return int |
||
141 | */ |
||
142 | public function getDelay() |
||
146 | |||
147 | /** |
||
148 | * @return string |
||
149 | */ |
||
150 | public function getID() |
||
154 | |||
155 | /** |
||
156 | * @return bool |
||
157 | */ |
||
158 | public function isDeprecated() |
||
162 | |||
163 | /** |
||
164 | * @return string|null |
||
165 | */ |
||
166 | public function getCorrelationID() |
||
170 | |||
171 | /** |
||
172 | * @param string $key |
||
173 | * @param mixed $default |
||
174 | * |
||
175 | * @return mixed |
||
176 | */ |
||
177 | public function getBodyValue($key, $default = null) |
||
185 | |||
186 | /** |
||
187 | * @param string $key |
||
188 | * |
||
189 | * @return mixed |
||
190 | * |
||
191 | * @throws DomainEventException |
||
192 | */ |
||
193 | public function getBodyValueOrFail($key) |
||
201 | |||
202 | /** |
||
203 | * @return string |
||
204 | */ |
||
205 | public function getContext() |
||
209 | |||
210 | /** |
||
211 | * @return array |
||
212 | */ |
||
213 | public function getAttributes() |
||
217 | |||
218 | /** |
||
219 | * @param string $origin |
||
220 | * @return DomainEvent $this |
||
221 | * @throws DomainEventException |
||
222 | */ |
||
223 | protected function setOrigin($origin) |
||
231 | |||
232 | /** |
||
233 | * @param string $name |
||
234 | * @return DomainEvent $this |
||
235 | * @throws DomainEventException |
||
236 | */ |
||
237 | protected function setName($name) |
||
245 | |||
246 | /** |
||
247 | * @param string $version |
||
248 | * @return DomainEvent $this |
||
249 | * @throws DomainEventException |
||
250 | */ |
||
251 | protected function setVersion($version) |
||
259 | |||
260 | /** |
||
261 | * @param int $occurredOn |
||
262 | * @return DomainEvent $this |
||
263 | * @throws DomainEventException |
||
264 | */ |
||
265 | protected function setOccurredOn($occurredOn) |
||
278 | |||
279 | /** |
||
280 | * @return array |
||
281 | */ |
||
282 | public function jsonSerialize() |
||
296 | } |