|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace AMQPAL\Adapter; |
|
4
|
|
|
|
|
5
|
|
|
use DateTime; |
|
6
|
|
|
|
|
7
|
|
|
class Message |
|
8
|
|
|
{ |
|
9
|
|
|
/** |
|
10
|
|
|
* @var string |
|
11
|
|
|
*/ |
|
12
|
|
|
protected $body; |
|
13
|
|
|
/** |
|
14
|
|
|
* @var string |
|
15
|
|
|
*/ |
|
16
|
|
|
protected $routingKey; |
|
17
|
|
|
/** |
|
18
|
|
|
* @var int |
|
19
|
|
|
*/ |
|
20
|
|
|
protected $deliveryTag; |
|
21
|
|
|
/** |
|
22
|
|
|
* @var int |
|
23
|
|
|
*/ |
|
24
|
|
|
protected $deliveryMode; |
|
25
|
|
|
/** |
|
26
|
|
|
* @var string |
|
27
|
|
|
*/ |
|
28
|
|
|
protected $exchangeName; |
|
29
|
|
|
/** |
|
30
|
|
|
* @var bool |
|
31
|
|
|
*/ |
|
32
|
|
|
protected $redelivered = false; |
|
33
|
|
|
/** |
|
34
|
|
|
* @var string |
|
35
|
|
|
*/ |
|
36
|
|
|
protected $contentType; |
|
37
|
|
|
/** |
|
38
|
|
|
* @var string |
|
39
|
|
|
*/ |
|
40
|
|
|
protected $contentEncoding; |
|
41
|
|
|
/** |
|
42
|
|
|
* @var string |
|
43
|
|
|
*/ |
|
44
|
|
|
protected $type; |
|
45
|
|
|
/** |
|
46
|
|
|
* @var DateTime |
|
47
|
|
|
*/ |
|
48
|
|
|
protected $dateTime; |
|
49
|
|
|
/** |
|
50
|
|
|
* @var int |
|
51
|
|
|
*/ |
|
52
|
|
|
protected $priority; |
|
53
|
|
|
/** |
|
54
|
|
|
* @var DateTime |
|
55
|
|
|
*/ |
|
56
|
|
|
protected $expiration; |
|
57
|
|
|
/** |
|
58
|
|
|
* @var string |
|
59
|
|
|
*/ |
|
60
|
|
|
protected $userId; |
|
61
|
|
|
/** |
|
62
|
|
|
* @var string |
|
63
|
|
|
*/ |
|
64
|
|
|
protected $appId; |
|
65
|
|
|
/** |
|
66
|
|
|
* @var string |
|
67
|
|
|
*/ |
|
68
|
|
|
protected $messageId; |
|
69
|
|
|
/** |
|
70
|
|
|
* @var string |
|
71
|
|
|
*/ |
|
72
|
|
|
protected $replyTo; |
|
73
|
|
|
/** |
|
74
|
|
|
* @var string |
|
75
|
|
|
*/ |
|
76
|
|
|
protected $correlationId; |
|
77
|
|
|
/** |
|
78
|
|
|
* @var array |
|
79
|
|
|
*/ |
|
80
|
|
|
protected $headers = []; |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* @return string |
|
84
|
|
|
*/ |
|
85
|
5 |
|
public function getBody() |
|
86
|
|
|
{ |
|
87
|
5 |
|
return $this->body; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* @return string |
|
92
|
|
|
*/ |
|
93
|
1 |
|
public function getRoutingKey() |
|
94
|
|
|
{ |
|
95
|
1 |
|
return $this->routingKey; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* @return int |
|
100
|
|
|
*/ |
|
101
|
5 |
|
public function getDeliveryTag() |
|
102
|
|
|
{ |
|
103
|
5 |
|
return $this->deliveryTag; |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* @return int |
|
108
|
|
|
*/ |
|
109
|
1 |
|
public function getDeliveryMode() |
|
110
|
|
|
{ |
|
111
|
1 |
|
return $this->deliveryMode; |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* @return string |
|
116
|
|
|
*/ |
|
117
|
1 |
|
public function getExchangeName() |
|
118
|
|
|
{ |
|
119
|
1 |
|
return $this->exchangeName; |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
/** |
|
123
|
|
|
* @return boolean |
|
124
|
|
|
*/ |
|
125
|
1 |
|
public function isRedelivered() |
|
126
|
|
|
{ |
|
127
|
1 |
|
return $this->redelivered; |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
/** |
|
131
|
|
|
* @return string |
|
132
|
|
|
*/ |
|
133
|
1 |
|
public function getContentType() |
|
134
|
|
|
{ |
|
135
|
1 |
|
return $this->contentType; |
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
|
|
/** |
|
139
|
|
|
* @return string |
|
140
|
|
|
*/ |
|
141
|
1 |
|
public function getContentEncoding() |
|
142
|
|
|
{ |
|
143
|
1 |
|
return $this->contentEncoding; |
|
144
|
|
|
} |
|
145
|
|
|
|
|
146
|
|
|
/** |
|
147
|
|
|
* @return string |
|
148
|
|
|
*/ |
|
149
|
1 |
|
public function getType() |
|
150
|
|
|
{ |
|
151
|
1 |
|
return $this->type; |
|
152
|
|
|
} |
|
153
|
|
|
|
|
154
|
|
|
/** |
|
155
|
|
|
* @return DateTime |
|
156
|
|
|
*/ |
|
157
|
1 |
|
public function getDateTime() |
|
158
|
|
|
{ |
|
159
|
1 |
|
return $this->dateTime; |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
/** |
|
163
|
|
|
* @return int |
|
164
|
|
|
*/ |
|
165
|
1 |
|
public function getPriority() |
|
166
|
|
|
{ |
|
167
|
1 |
|
return $this->priority; |
|
168
|
|
|
} |
|
169
|
|
|
|
|
170
|
|
|
/** |
|
171
|
|
|
* @return DateTime |
|
172
|
|
|
*/ |
|
173
|
1 |
|
public function getExpiration() |
|
174
|
|
|
{ |
|
175
|
1 |
|
return $this->expiration; |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
/** |
|
179
|
|
|
* @return string |
|
180
|
|
|
*/ |
|
181
|
1 |
|
public function getUserId() |
|
182
|
|
|
{ |
|
183
|
1 |
|
return $this->userId; |
|
184
|
|
|
} |
|
185
|
|
|
|
|
186
|
|
|
/** |
|
187
|
|
|
* @return string |
|
188
|
|
|
*/ |
|
189
|
1 |
|
public function getAppId() |
|
190
|
|
|
{ |
|
191
|
1 |
|
return $this->appId; |
|
192
|
|
|
} |
|
193
|
|
|
|
|
194
|
|
|
/** |
|
195
|
|
|
* @return string |
|
196
|
|
|
*/ |
|
197
|
1 |
|
public function getMessageId() |
|
198
|
|
|
{ |
|
199
|
1 |
|
return $this->messageId; |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
/** |
|
203
|
|
|
* @return string |
|
204
|
|
|
*/ |
|
205
|
1 |
|
public function getReplyTo() |
|
206
|
|
|
{ |
|
207
|
1 |
|
return $this->replyTo; |
|
208
|
|
|
} |
|
209
|
|
|
|
|
210
|
|
|
/** |
|
211
|
|
|
* @return string |
|
212
|
|
|
*/ |
|
213
|
1 |
|
public function getCorrelationId() |
|
214
|
|
|
{ |
|
215
|
1 |
|
return $this->correlationId; |
|
216
|
|
|
} |
|
217
|
|
|
|
|
218
|
|
|
/** |
|
219
|
|
|
* @return array |
|
220
|
|
|
*/ |
|
221
|
1 |
|
public function getHeaders() |
|
222
|
|
|
{ |
|
223
|
1 |
|
return $this->headers; |
|
224
|
|
|
} |
|
225
|
|
|
|
|
226
|
|
|
/** |
|
227
|
|
|
* @param string $body |
|
228
|
|
|
* @return $this |
|
229
|
|
|
*/ |
|
230
|
11 |
|
public function setBody($body) |
|
231
|
|
|
{ |
|
232
|
11 |
|
$this->body = $body; |
|
233
|
11 |
|
return $this; |
|
234
|
|
|
} |
|
235
|
|
|
|
|
236
|
|
|
/** |
|
237
|
|
|
* @param string $routingKey |
|
238
|
|
|
* @return $this |
|
239
|
|
|
*/ |
|
240
|
11 |
|
public function setRoutingKey($routingKey) |
|
241
|
|
|
{ |
|
242
|
11 |
|
$this->routingKey = $routingKey; |
|
243
|
11 |
|
return $this; |
|
244
|
|
|
} |
|
245
|
|
|
|
|
246
|
|
|
/** |
|
247
|
|
|
* @param int $deliveryTag |
|
248
|
|
|
* @return $this |
|
249
|
|
|
*/ |
|
250
|
11 |
|
public function setDeliveryTag($deliveryTag) |
|
251
|
|
|
{ |
|
252
|
11 |
|
$this->deliveryTag = $deliveryTag; |
|
253
|
11 |
|
return $this; |
|
254
|
|
|
} |
|
255
|
|
|
|
|
256
|
|
|
/** |
|
257
|
|
|
* @param int $deliveryMode |
|
258
|
|
|
* @return $this |
|
259
|
|
|
*/ |
|
260
|
11 |
|
public function setDeliveryMode($deliveryMode) |
|
261
|
|
|
{ |
|
262
|
11 |
|
$this->deliveryMode = $deliveryMode; |
|
263
|
11 |
|
return $this; |
|
264
|
|
|
} |
|
265
|
|
|
|
|
266
|
|
|
/** |
|
267
|
|
|
* @param string $exchangeName |
|
268
|
|
|
* @return $this |
|
269
|
|
|
*/ |
|
270
|
11 |
|
public function setExchangeName($exchangeName) |
|
271
|
|
|
{ |
|
272
|
11 |
|
$this->exchangeName = $exchangeName; |
|
273
|
11 |
|
return $this; |
|
274
|
|
|
} |
|
275
|
|
|
|
|
276
|
|
|
/** |
|
277
|
|
|
* @param boolean $redelivered |
|
278
|
|
|
* @return $this |
|
279
|
|
|
*/ |
|
280
|
11 |
|
public function setRedelivered($redelivered) |
|
281
|
|
|
{ |
|
282
|
11 |
|
$this->redelivered = $redelivered; |
|
283
|
11 |
|
return $this; |
|
284
|
|
|
} |
|
285
|
|
|
|
|
286
|
|
|
/** |
|
287
|
|
|
* @param string $contentType |
|
288
|
|
|
* @return $this |
|
289
|
|
|
*/ |
|
290
|
11 |
|
public function setContentType($contentType) |
|
291
|
|
|
{ |
|
292
|
11 |
|
$this->contentType = $contentType; |
|
293
|
11 |
|
return $this; |
|
294
|
|
|
} |
|
295
|
|
|
|
|
296
|
|
|
/** |
|
297
|
|
|
* @param string $contentEncoding |
|
298
|
|
|
* @return $this |
|
299
|
|
|
*/ |
|
300
|
11 |
|
public function setContentEncoding($contentEncoding) |
|
301
|
|
|
{ |
|
302
|
11 |
|
$this->contentEncoding = $contentEncoding; |
|
303
|
11 |
|
return $this; |
|
304
|
|
|
} |
|
305
|
|
|
|
|
306
|
|
|
/** |
|
307
|
|
|
* @param string $type |
|
308
|
|
|
* @return $this |
|
309
|
|
|
*/ |
|
310
|
11 |
|
public function setType($type) |
|
311
|
|
|
{ |
|
312
|
11 |
|
$this->type = $type; |
|
313
|
11 |
|
return $this; |
|
314
|
|
|
} |
|
315
|
|
|
|
|
316
|
|
|
/** |
|
317
|
|
|
* @param DateTime $dateTime |
|
318
|
|
|
* @return $this |
|
319
|
|
|
*/ |
|
320
|
11 |
|
public function setDateTime(DateTime $dateTime = null) |
|
321
|
|
|
{ |
|
322
|
11 |
|
$this->dateTime = $dateTime; |
|
323
|
11 |
|
return $this; |
|
324
|
|
|
} |
|
325
|
|
|
|
|
326
|
|
|
/** |
|
327
|
|
|
* @param int $priority |
|
328
|
|
|
* @return $this |
|
329
|
|
|
*/ |
|
330
|
11 |
|
public function setPriority($priority) |
|
331
|
|
|
{ |
|
332
|
11 |
|
$this->priority = $priority; |
|
333
|
11 |
|
return $this; |
|
334
|
|
|
} |
|
335
|
|
|
|
|
336
|
|
|
/** |
|
337
|
|
|
* @param DateTime $expiration |
|
338
|
|
|
* @return $this |
|
339
|
|
|
*/ |
|
340
|
11 |
|
public function setExpiration(DateTime $expiration = null) |
|
341
|
|
|
{ |
|
342
|
11 |
|
$this->expiration = $expiration; |
|
343
|
11 |
|
return $this; |
|
344
|
|
|
} |
|
345
|
|
|
|
|
346
|
|
|
/** |
|
347
|
|
|
* @param string $userId |
|
348
|
|
|
* @return $this |
|
349
|
|
|
*/ |
|
350
|
11 |
|
public function setUserId($userId) |
|
351
|
|
|
{ |
|
352
|
11 |
|
$this->userId = $userId; |
|
353
|
11 |
|
return $this; |
|
354
|
|
|
} |
|
355
|
|
|
|
|
356
|
|
|
/** |
|
357
|
|
|
* @param string $appId |
|
358
|
|
|
* @return $this |
|
359
|
|
|
*/ |
|
360
|
11 |
|
public function setAppId($appId) |
|
361
|
|
|
{ |
|
362
|
11 |
|
$this->appId = $appId; |
|
363
|
11 |
|
return $this; |
|
364
|
|
|
} |
|
365
|
|
|
|
|
366
|
|
|
/** |
|
367
|
|
|
* @param string $messageId |
|
368
|
|
|
* @return $this |
|
369
|
|
|
*/ |
|
370
|
11 |
|
public function setMessageId($messageId) |
|
371
|
|
|
{ |
|
372
|
11 |
|
$this->messageId = $messageId; |
|
373
|
11 |
|
return $this; |
|
374
|
|
|
} |
|
375
|
|
|
|
|
376
|
|
|
/** |
|
377
|
|
|
* @param string $replyTo |
|
378
|
|
|
* @return $this |
|
379
|
|
|
*/ |
|
380
|
11 |
|
public function setReplyTo($replyTo) |
|
381
|
|
|
{ |
|
382
|
11 |
|
$this->replyTo = $replyTo; |
|
383
|
11 |
|
return $this; |
|
384
|
|
|
} |
|
385
|
|
|
|
|
386
|
|
|
/** |
|
387
|
|
|
* @param string $correlationId |
|
388
|
|
|
* @return $this |
|
389
|
|
|
*/ |
|
390
|
11 |
|
public function setCorrelationId($correlationId) |
|
391
|
|
|
{ |
|
392
|
11 |
|
$this->correlationId = $correlationId; |
|
393
|
11 |
|
return $this; |
|
394
|
|
|
} |
|
395
|
|
|
|
|
396
|
|
|
/** |
|
397
|
|
|
* @param array $headers |
|
398
|
|
|
* @return $this |
|
399
|
|
|
*/ |
|
400
|
11 |
|
public function setHeaders(array $headers) |
|
401
|
|
|
{ |
|
402
|
11 |
|
$this->headers = $headers; |
|
403
|
11 |
|
return $this; |
|
404
|
|
|
} |
|
405
|
|
|
} |
|
406
|
|
|
|