1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* This file was autogenerated by spec/parser.php - Do not modify */ |
4
|
|
|
|
5
|
|
|
namespace PhpAmqpLib\Helper\Protocol; |
6
|
|
|
|
7
|
|
|
use PhpAmqpLib\Wire\AMQPWriter; |
8
|
|
|
use PhpAmqpLib\Wire\AMQPReader; |
9
|
|
|
|
10
|
|
|
class Protocol091 |
11
|
|
|
{ |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @return array |
15
|
|
|
*/ |
16
|
|
|
public function connectionStart($version_major = 0, $version_minor = 9, $server_properties, $mechanisms = 'PLAIN', $locales = 'en_US') |
17
|
|
|
{ |
18
|
|
|
$args = new AMQPWriter(); |
19
|
|
|
$args->write_octet($version_major); |
20
|
|
|
$args->write_octet($version_minor); |
21
|
|
|
$args->write_table(empty($server_properties) ? array() : $server_properties); |
22
|
|
|
$args->write_longstr($mechanisms); |
23
|
|
|
$args->write_longstr($locales); |
24
|
|
|
return array(10, 10, $args); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
|
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @param AMQPReader $args |
31
|
|
|
* @return array |
32
|
|
|
*/ |
33
|
|
View Code Duplication |
public static function connectionStartOk($args) |
|
|
|
|
34
|
|
|
{ |
35
|
|
|
$ret = array(); |
36
|
|
|
$ret[] = $args->read_table(); |
37
|
|
|
$ret[] = $args->read_shortstr(); |
38
|
|
|
$ret[] = $args->read_longstr(); |
39
|
|
|
$ret[] = $args->read_shortstr(); |
40
|
|
|
return $ret; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
|
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @return array |
47
|
|
|
*/ |
48
|
|
|
public function connectionSecure($challenge) |
49
|
|
|
{ |
50
|
|
|
$args = new AMQPWriter(); |
51
|
|
|
$args->write_longstr($challenge); |
52
|
|
|
return array(10, 20, $args); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
|
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @param AMQPReader $args |
59
|
|
|
* @return array |
60
|
|
|
*/ |
61
|
|
|
public static function connectionSecureOk($args) |
62
|
|
|
{ |
63
|
|
|
$ret = array(); |
64
|
|
|
$ret[] = $args->read_longstr(); |
65
|
|
|
return $ret; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
|
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @return array |
72
|
|
|
*/ |
73
|
|
View Code Duplication |
public function connectionTune($channel_max = 0, $frame_max = 0, $heartbeat = 0) |
|
|
|
|
74
|
|
|
{ |
75
|
|
|
$args = new AMQPWriter(); |
76
|
|
|
$args->write_short($channel_max); |
77
|
|
|
$args->write_long($frame_max); |
78
|
|
|
$args->write_short($heartbeat); |
79
|
|
|
return array(10, 30, $args); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
|
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @param AMQPReader $args |
86
|
|
|
* @return array |
87
|
|
|
*/ |
88
|
|
View Code Duplication |
public static function connectionTuneOk($args) |
|
|
|
|
89
|
|
|
{ |
90
|
|
|
$ret = array(); |
91
|
|
|
$ret[] = $args->read_short(); |
92
|
|
|
$ret[] = $args->read_long(); |
93
|
|
|
$ret[] = $args->read_short(); |
94
|
|
|
return $ret; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
|
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @return array |
101
|
|
|
*/ |
102
|
|
View Code Duplication |
public function connectionOpen($virtual_host = '/', $capabilities = '', $insist = false) |
|
|
|
|
103
|
|
|
{ |
104
|
|
|
$args = new AMQPWriter(); |
105
|
|
|
$args->write_shortstr($virtual_host); |
106
|
|
|
$args->write_shortstr($capabilities); |
107
|
|
|
$args->write_bits(array($insist)); |
108
|
|
|
return array(10, 40, $args); |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
|
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* @param AMQPReader $args |
115
|
|
|
* @return array |
116
|
|
|
*/ |
117
|
|
|
public static function connectionOpenOk($args) |
118
|
|
|
{ |
119
|
|
|
$ret = array(); |
120
|
|
|
$ret[] = $args->read_shortstr(); |
121
|
|
|
return $ret; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
|
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @return array |
128
|
|
|
*/ |
129
|
60 |
View Code Duplication |
public function connectionClose($reply_code, $reply_text = '', $class_id, $method_id) |
|
|
|
|
130
|
|
|
{ |
131
|
60 |
|
$args = new AMQPWriter(); |
132
|
60 |
|
$args->write_short($reply_code); |
133
|
60 |
|
$args->write_shortstr($reply_text); |
134
|
60 |
|
$args->write_short($class_id); |
135
|
60 |
|
$args->write_short($method_id); |
136
|
60 |
|
return array(10, 50, $args); |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
|
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* @param AMQPReader $args |
143
|
|
|
* @return array |
144
|
|
|
*/ |
145
|
|
|
public static function connectionCloseOk($args) |
|
|
|
|
146
|
|
|
{ |
147
|
|
|
$ret = array(); |
148
|
|
|
return $ret; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
|
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* @return array |
155
|
|
|
*/ |
156
|
5 |
|
public function connectionBlocked($reason = '') |
157
|
|
|
{ |
158
|
5 |
|
$args = new AMQPWriter(); |
159
|
5 |
|
$args->write_shortstr($reason); |
160
|
5 |
|
return array(10, 60, $args); |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
|
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* @param AMQPReader $args |
167
|
|
|
* @return array |
168
|
|
|
*/ |
169
|
|
|
public static function connectionUnblocked($args) |
|
|
|
|
170
|
|
|
{ |
171
|
|
|
$ret = array(); |
172
|
|
|
return $ret; |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
|
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* @return array |
179
|
|
|
*/ |
180
|
65 |
|
public function channelOpen($out_of_band = '') |
181
|
|
|
{ |
182
|
65 |
|
$args = new AMQPWriter(); |
183
|
65 |
|
$args->write_shortstr($out_of_band); |
184
|
65 |
|
return array(20, 10, $args); |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
|
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* @param AMQPReader $args |
191
|
|
|
* @return array |
192
|
|
|
*/ |
193
|
|
|
public static function channelOpenOk($args) |
194
|
|
|
{ |
195
|
|
|
$ret = array(); |
196
|
|
|
$ret[] = $args->read_longstr(); |
197
|
|
|
return $ret; |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
|
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* @return array |
204
|
|
|
*/ |
205
|
5 |
|
public function channelFlow($active) |
206
|
|
|
{ |
207
|
5 |
|
$args = new AMQPWriter(); |
208
|
5 |
|
$args->write_bits(array($active)); |
209
|
5 |
|
return array(20, 20, $args); |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
|
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* @param AMQPReader $args |
216
|
|
|
* @return array |
217
|
|
|
*/ |
218
|
|
|
public static function channelFlowOk($args) |
219
|
|
|
{ |
220
|
|
|
$ret = array(); |
221
|
|
|
$ret[] = $args->read_bit(); |
222
|
|
|
return $ret; |
223
|
|
|
} |
224
|
|
|
|
225
|
|
|
|
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* @return array |
229
|
|
|
*/ |
230
|
65 |
View Code Duplication |
public function channelClose($reply_code, $reply_text = '', $class_id, $method_id) |
|
|
|
|
231
|
|
|
{ |
232
|
65 |
|
$args = new AMQPWriter(); |
233
|
65 |
|
$args->write_short($reply_code); |
234
|
65 |
|
$args->write_shortstr($reply_text); |
235
|
65 |
|
$args->write_short($class_id); |
236
|
65 |
|
$args->write_short($method_id); |
237
|
65 |
|
return array(20, 40, $args); |
238
|
|
|
} |
239
|
|
|
|
240
|
|
|
|
241
|
|
|
|
242
|
|
|
/** |
243
|
|
|
* @param AMQPReader $args |
244
|
|
|
* @return array |
245
|
|
|
*/ |
246
|
|
|
public static function channelCloseOk($args) |
|
|
|
|
247
|
|
|
{ |
248
|
|
|
$ret = array(); |
249
|
|
|
return $ret; |
250
|
|
|
} |
251
|
|
|
|
252
|
|
|
|
253
|
|
|
|
254
|
|
|
/** |
255
|
|
|
* @return array |
256
|
|
|
*/ |
257
|
5 |
View Code Duplication |
public function accessRequest($realm = '/data', $exclusive = false, $passive = true, $active = true, $write = true, $read = true) |
|
|
|
|
258
|
|
|
{ |
259
|
5 |
|
$args = new AMQPWriter(); |
260
|
5 |
|
$args->write_shortstr($realm); |
261
|
5 |
|
$args->write_bits(array($exclusive, $passive, $active, $write, $read)); |
262
|
5 |
|
return array(30, 10, $args); |
263
|
|
|
} |
264
|
|
|
|
265
|
|
|
|
266
|
|
|
|
267
|
|
|
/** |
268
|
|
|
* @param AMQPReader $args |
269
|
|
|
* @return array |
270
|
|
|
*/ |
271
|
|
|
public static function accessRequestOk($args) |
272
|
|
|
{ |
273
|
|
|
$ret = array(); |
274
|
|
|
$ret[] = $args->read_short(); |
275
|
|
|
return $ret; |
276
|
|
|
} |
277
|
|
|
|
278
|
|
|
|
279
|
|
|
|
280
|
|
|
/** |
281
|
|
|
* @return array |
282
|
|
|
*/ |
283
|
60 |
View Code Duplication |
public function exchangeDeclare($ticket = 0, $exchange, $type = 'direct', $passive = false, $durable = false, $auto_delete = false, $internal = false, $nowait = false, $arguments = array()) |
|
|
|
|
284
|
|
|
{ |
285
|
60 |
|
$args = new AMQPWriter(); |
286
|
60 |
|
$args->write_short($ticket); |
287
|
60 |
|
$args->write_shortstr($exchange); |
288
|
60 |
|
$args->write_shortstr($type); |
289
|
60 |
|
$args->write_bits(array($passive, $durable, $auto_delete, $internal, $nowait)); |
290
|
60 |
|
$args->write_table(empty($arguments) ? array() : $arguments); |
291
|
60 |
|
return array(40, 10, $args); |
292
|
|
|
} |
293
|
|
|
|
294
|
|
|
|
295
|
|
|
|
296
|
|
|
/** |
297
|
|
|
* @param AMQPReader $args |
298
|
|
|
* @return array |
299
|
|
|
*/ |
300
|
|
|
public static function exchangeDeclareOk($args) |
|
|
|
|
301
|
|
|
{ |
302
|
|
|
$ret = array(); |
303
|
|
|
return $ret; |
304
|
|
|
} |
305
|
|
|
|
306
|
|
|
|
307
|
|
|
|
308
|
|
|
/** |
309
|
|
|
* @return array |
310
|
|
|
*/ |
311
|
60 |
|
public function exchangeDelete($ticket = 0, $exchange, $if_unused = false, $nowait = false) |
312
|
|
|
{ |
313
|
60 |
|
$args = new AMQPWriter(); |
314
|
60 |
|
$args->write_short($ticket); |
315
|
60 |
|
$args->write_shortstr($exchange); |
316
|
60 |
|
$args->write_bits(array($if_unused, $nowait)); |
317
|
60 |
|
return array(40, 20, $args); |
318
|
|
|
} |
319
|
|
|
|
320
|
|
|
|
321
|
|
|
|
322
|
|
|
/** |
323
|
|
|
* @param AMQPReader $args |
324
|
|
|
* @return array |
325
|
|
|
*/ |
326
|
|
|
public static function exchangeDeleteOk($args) |
|
|
|
|
327
|
|
|
{ |
328
|
|
|
$ret = array(); |
329
|
|
|
return $ret; |
330
|
|
|
} |
331
|
|
|
|
332
|
|
|
|
333
|
|
|
|
334
|
|
|
/** |
335
|
|
|
* @return array |
336
|
|
|
*/ |
337
|
5 |
View Code Duplication |
public function exchangeBind($ticket = 0, $destination, $source, $routing_key = '', $nowait = false, $arguments = array()) |
|
|
|
|
338
|
|
|
{ |
339
|
5 |
|
$args = new AMQPWriter(); |
340
|
5 |
|
$args->write_short($ticket); |
341
|
5 |
|
$args->write_shortstr($destination); |
342
|
5 |
|
$args->write_shortstr($source); |
343
|
5 |
|
$args->write_shortstr($routing_key); |
344
|
5 |
|
$args->write_bits(array($nowait)); |
345
|
5 |
|
$args->write_table(empty($arguments) ? array() : $arguments); |
346
|
5 |
|
return array(40, 30, $args); |
347
|
|
|
} |
348
|
|
|
|
349
|
|
|
|
350
|
|
|
|
351
|
|
|
/** |
352
|
|
|
* @param AMQPReader $args |
353
|
|
|
* @return array |
354
|
|
|
*/ |
355
|
|
|
public static function exchangeBindOk($args) |
|
|
|
|
356
|
|
|
{ |
357
|
|
|
$ret = array(); |
358
|
|
|
return $ret; |
359
|
|
|
} |
360
|
|
|
|
361
|
|
|
|
362
|
|
|
|
363
|
|
|
/** |
364
|
|
|
* @return array |
365
|
|
|
*/ |
366
|
5 |
View Code Duplication |
public function exchangeUnbind($ticket = 0, $destination, $source, $routing_key = '', $nowait = false, $arguments = array()) |
|
|
|
|
367
|
|
|
{ |
368
|
5 |
|
$args = new AMQPWriter(); |
369
|
5 |
|
$args->write_short($ticket); |
370
|
5 |
|
$args->write_shortstr($destination); |
371
|
5 |
|
$args->write_shortstr($source); |
372
|
5 |
|
$args->write_shortstr($routing_key); |
373
|
5 |
|
$args->write_bits(array($nowait)); |
374
|
5 |
|
$args->write_table(empty($arguments) ? array() : $arguments); |
375
|
5 |
|
return array(40, 40, $args); |
376
|
|
|
} |
377
|
|
|
|
378
|
|
|
|
379
|
|
|
|
380
|
|
|
/** |
381
|
|
|
* @param AMQPReader $args |
382
|
|
|
* @return array |
383
|
|
|
*/ |
384
|
|
|
public static function exchangeUnbindOk($args) |
|
|
|
|
385
|
|
|
{ |
386
|
|
|
$ret = array(); |
387
|
|
|
return $ret; |
388
|
|
|
} |
389
|
|
|
|
390
|
|
|
|
391
|
|
|
|
392
|
|
|
/** |
393
|
|
|
* @return array |
394
|
|
|
*/ |
395
|
65 |
View Code Duplication |
public function queueDeclare($ticket = 0, $queue = '', $passive = false, $durable = false, $exclusive = false, $auto_delete = false, $nowait = false, $arguments = array()) |
|
|
|
|
396
|
|
|
{ |
397
|
65 |
|
$args = new AMQPWriter(); |
398
|
65 |
|
$args->write_short($ticket); |
399
|
65 |
|
$args->write_shortstr($queue); |
400
|
65 |
|
$args->write_bits(array($passive, $durable, $exclusive, $auto_delete, $nowait)); |
401
|
65 |
|
$args->write_table(empty($arguments) ? array() : $arguments); |
402
|
65 |
|
return array(50, 10, $args); |
403
|
|
|
} |
404
|
|
|
|
405
|
|
|
|
406
|
|
|
|
407
|
|
|
/** |
408
|
|
|
* @param AMQPReader $args |
409
|
|
|
* @return array |
410
|
|
|
*/ |
411
|
|
View Code Duplication |
public static function queueDeclareOk($args) |
|
|
|
|
412
|
|
|
{ |
413
|
|
|
$ret = array(); |
414
|
|
|
$ret[] = $args->read_shortstr(); |
415
|
|
|
$ret[] = $args->read_long(); |
416
|
|
|
$ret[] = $args->read_long(); |
417
|
|
|
return $ret; |
418
|
|
|
} |
419
|
|
|
|
420
|
|
|
|
421
|
|
|
|
422
|
|
|
/** |
423
|
|
|
* @return array |
424
|
|
|
*/ |
425
|
60 |
View Code Duplication |
public function queueBind($ticket = 0, $queue = '', $exchange, $routing_key = '', $nowait = false, $arguments = array()) |
|
|
|
|
426
|
|
|
{ |
427
|
60 |
|
$args = new AMQPWriter(); |
428
|
60 |
|
$args->write_short($ticket); |
429
|
60 |
|
$args->write_shortstr($queue); |
430
|
60 |
|
$args->write_shortstr($exchange); |
431
|
60 |
|
$args->write_shortstr($routing_key); |
432
|
60 |
|
$args->write_bits(array($nowait)); |
433
|
60 |
|
$args->write_table(empty($arguments) ? array() : $arguments); |
434
|
60 |
|
return array(50, 20, $args); |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
|
438
|
|
|
|
439
|
|
|
/** |
440
|
|
|
* @param AMQPReader $args |
441
|
|
|
* @return array |
442
|
|
|
*/ |
443
|
|
|
public static function queueBindOk($args) |
|
|
|
|
444
|
|
|
{ |
445
|
|
|
$ret = array(); |
446
|
|
|
return $ret; |
447
|
|
|
} |
448
|
|
|
|
449
|
|
|
|
450
|
|
|
|
451
|
|
|
/** |
452
|
|
|
* @return array |
453
|
|
|
*/ |
454
|
5 |
View Code Duplication |
public function queuePurge($ticket = 0, $queue = '', $nowait = false) |
|
|
|
|
455
|
|
|
{ |
456
|
5 |
|
$args = new AMQPWriter(); |
457
|
5 |
|
$args->write_short($ticket); |
458
|
5 |
|
$args->write_shortstr($queue); |
459
|
5 |
|
$args->write_bits(array($nowait)); |
460
|
5 |
|
return array(50, 30, $args); |
461
|
|
|
} |
462
|
|
|
|
463
|
|
|
|
464
|
|
|
|
465
|
|
|
/** |
466
|
|
|
* @param AMQPReader $args |
467
|
|
|
* @return array |
468
|
|
|
*/ |
469
|
|
|
public static function queuePurgeOk($args) |
470
|
|
|
{ |
471
|
|
|
$ret = array(); |
472
|
|
|
$ret[] = $args->read_long(); |
473
|
|
|
return $ret; |
474
|
|
|
} |
475
|
|
|
|
476
|
|
|
|
477
|
|
|
|
478
|
|
|
/** |
479
|
|
|
* @return array |
480
|
|
|
*/ |
481
|
25 |
|
public function queueDelete($ticket = 0, $queue = '', $if_unused = false, $if_empty = false, $nowait = false) |
482
|
|
|
{ |
483
|
25 |
|
$args = new AMQPWriter(); |
484
|
25 |
|
$args->write_short($ticket); |
485
|
25 |
|
$args->write_shortstr($queue); |
486
|
25 |
|
$args->write_bits(array($if_unused, $if_empty, $nowait)); |
487
|
25 |
|
return array(50, 40, $args); |
488
|
|
|
} |
489
|
|
|
|
490
|
|
|
|
491
|
|
|
|
492
|
|
|
/** |
493
|
|
|
* @param AMQPReader $args |
494
|
|
|
* @return array |
495
|
|
|
*/ |
496
|
|
|
public static function queueDeleteOk($args) |
497
|
|
|
{ |
498
|
|
|
$ret = array(); |
499
|
|
|
$ret[] = $args->read_long(); |
500
|
|
|
return $ret; |
501
|
|
|
} |
502
|
|
|
|
503
|
|
|
|
504
|
|
|
|
505
|
|
|
/** |
506
|
|
|
* @return array |
507
|
|
|
*/ |
508
|
5 |
View Code Duplication |
public function queueUnbind($ticket = 0, $queue = '', $exchange, $routing_key = '', $arguments = array()) |
|
|
|
|
509
|
|
|
{ |
510
|
5 |
|
$args = new AMQPWriter(); |
511
|
5 |
|
$args->write_short($ticket); |
512
|
5 |
|
$args->write_shortstr($queue); |
513
|
5 |
|
$args->write_shortstr($exchange); |
514
|
5 |
|
$args->write_shortstr($routing_key); |
515
|
5 |
|
$args->write_table(empty($arguments) ? array() : $arguments); |
516
|
5 |
|
return array(50, 50, $args); |
517
|
|
|
} |
518
|
|
|
|
519
|
|
|
|
520
|
|
|
|
521
|
|
|
/** |
522
|
|
|
* @param AMQPReader $args |
523
|
|
|
* @return array |
524
|
|
|
*/ |
525
|
|
|
public static function queueUnbindOk($args) |
|
|
|
|
526
|
|
|
{ |
527
|
|
|
$ret = array(); |
528
|
|
|
return $ret; |
529
|
|
|
} |
530
|
|
|
|
531
|
|
|
|
532
|
|
|
|
533
|
|
|
/** |
534
|
|
|
* @return array |
535
|
|
|
*/ |
536
|
5 |
View Code Duplication |
public function basicQos($prefetch_size = 0, $prefetch_count = 0, $global = false) |
|
|
|
|
537
|
|
|
{ |
538
|
5 |
|
$args = new AMQPWriter(); |
539
|
5 |
|
$args->write_long($prefetch_size); |
540
|
5 |
|
$args->write_short($prefetch_count); |
541
|
5 |
|
$args->write_bits(array($global)); |
542
|
5 |
|
return array(60, 10, $args); |
543
|
|
|
} |
544
|
|
|
|
545
|
|
|
|
546
|
|
|
|
547
|
|
|
/** |
548
|
|
|
* @param AMQPReader $args |
549
|
|
|
* @return array |
550
|
|
|
*/ |
551
|
|
|
public static function basicQosOk($args) |
|
|
|
|
552
|
|
|
{ |
553
|
|
|
$ret = array(); |
554
|
|
|
return $ret; |
555
|
|
|
} |
556
|
|
|
|
557
|
|
|
|
558
|
|
|
|
559
|
|
|
/** |
560
|
|
|
* @return array |
561
|
|
|
*/ |
562
|
30 |
View Code Duplication |
public function basicConsume($ticket = 0, $queue = '', $consumer_tag = '', $no_local = false, $no_ack = false, $exclusive = false, $nowait = false, $arguments = array()) |
|
|
|
|
563
|
|
|
{ |
564
|
30 |
|
$args = new AMQPWriter(); |
565
|
30 |
|
$args->write_short($ticket); |
566
|
30 |
|
$args->write_shortstr($queue); |
567
|
30 |
|
$args->write_shortstr($consumer_tag); |
568
|
30 |
|
$args->write_bits(array($no_local, $no_ack, $exclusive, $nowait)); |
569
|
30 |
|
$args->write_table(empty($arguments) ? array() : $arguments); |
570
|
30 |
|
return array(60, 20, $args); |
571
|
|
|
} |
572
|
|
|
|
573
|
|
|
|
574
|
|
|
|
575
|
|
|
/** |
576
|
|
|
* @param AMQPReader $args |
577
|
|
|
* @return array |
578
|
|
|
*/ |
579
|
|
|
public static function basicConsumeOk($args) |
580
|
|
|
{ |
581
|
|
|
$ret = array(); |
582
|
|
|
$ret[] = $args->read_shortstr(); |
583
|
|
|
return $ret; |
584
|
|
|
} |
585
|
|
|
|
586
|
|
|
|
587
|
|
|
|
588
|
|
|
/** |
589
|
|
|
* @return array |
590
|
|
|
*/ |
591
|
30 |
View Code Duplication |
public function basicCancel($consumer_tag, $nowait = false) |
|
|
|
|
592
|
|
|
{ |
593
|
30 |
|
$args = new AMQPWriter(); |
594
|
30 |
|
$args->write_shortstr($consumer_tag); |
595
|
30 |
|
$args->write_bits(array($nowait)); |
596
|
30 |
|
return array(60, 30, $args); |
597
|
|
|
} |
598
|
|
|
|
599
|
|
|
|
600
|
|
|
|
601
|
|
|
/** |
602
|
|
|
* @param AMQPReader $args |
603
|
|
|
* @return array |
604
|
|
|
*/ |
605
|
|
|
public static function basicCancelOk($args) |
606
|
|
|
{ |
607
|
|
|
$ret = array(); |
608
|
|
|
$ret[] = $args->read_shortstr(); |
609
|
|
|
return $ret; |
610
|
|
|
} |
611
|
|
|
|
612
|
|
|
|
613
|
|
|
|
614
|
|
|
/** |
615
|
|
|
* @return array |
616
|
|
|
*/ |
617
|
60 |
View Code Duplication |
public function basicPublish($ticket = 0, $exchange = '', $routing_key = '', $mandatory = false, $immediate = false) |
|
|
|
|
618
|
|
|
{ |
619
|
60 |
|
$args = new AMQPWriter(); |
620
|
60 |
|
$args->write_short($ticket); |
621
|
60 |
|
$args->write_shortstr($exchange); |
622
|
60 |
|
$args->write_shortstr($routing_key); |
623
|
60 |
|
$args->write_bits(array($mandatory, $immediate)); |
624
|
60 |
|
return array(60, 40, $args); |
625
|
|
|
} |
626
|
|
|
|
627
|
|
|
|
628
|
|
|
|
629
|
|
|
/** |
630
|
|
|
* @return array |
631
|
|
|
*/ |
632
|
|
View Code Duplication |
public function basicReturn($reply_code, $reply_text = '', $exchange, $routing_key) |
|
|
|
|
633
|
|
|
{ |
634
|
|
|
$args = new AMQPWriter(); |
635
|
|
|
$args->write_short($reply_code); |
636
|
|
|
$args->write_shortstr($reply_text); |
637
|
|
|
$args->write_shortstr($exchange); |
638
|
|
|
$args->write_shortstr($routing_key); |
639
|
|
|
return array(60, 50, $args); |
640
|
|
|
} |
641
|
|
|
|
642
|
|
|
|
643
|
|
|
|
644
|
|
|
/** |
645
|
|
|
* @return array |
646
|
|
|
*/ |
647
|
|
View Code Duplication |
public function basicDeliver($consumer_tag, $delivery_tag, $redelivered = false, $exchange, $routing_key) |
|
|
|
|
648
|
|
|
{ |
649
|
|
|
$args = new AMQPWriter(); |
650
|
|
|
$args->write_shortstr($consumer_tag); |
651
|
|
|
$args->write_longlong($delivery_tag); |
652
|
|
|
$args->write_bits(array($redelivered)); |
653
|
|
|
$args->write_shortstr($exchange); |
654
|
|
|
$args->write_shortstr($routing_key); |
655
|
|
|
return array(60, 60, $args); |
656
|
|
|
} |
657
|
|
|
|
658
|
|
|
|
659
|
|
|
|
660
|
|
|
/** |
661
|
|
|
* @return array |
662
|
|
|
*/ |
663
|
25 |
|
public function basicGet($ticket = 0, $queue = '', $no_ack = false) |
664
|
|
|
{ |
665
|
25 |
|
$args = new AMQPWriter(); |
666
|
25 |
|
$args->write_short($ticket); |
667
|
25 |
|
$args->write_shortstr($queue); |
668
|
25 |
|
$args->write_bits(array($no_ack)); |
669
|
25 |
|
return array(60, 70, $args); |
670
|
|
|
} |
671
|
|
|
|
672
|
|
|
|
673
|
|
|
|
674
|
|
|
/** |
675
|
|
|
* @param AMQPReader $args |
676
|
|
|
* @return array |
677
|
|
|
*/ |
678
|
|
View Code Duplication |
public static function basicGetOk($args) |
|
|
|
|
679
|
|
|
{ |
680
|
|
|
$ret = array(); |
681
|
|
|
$ret[] = $args->read_longlong(); |
682
|
|
|
$ret[] = $args->read_bit(); |
683
|
|
|
$ret[] = $args->read_shortstr(); |
684
|
|
|
$ret[] = $args->read_shortstr(); |
685
|
|
|
$ret[] = $args->read_long(); |
686
|
|
|
return $ret; |
687
|
|
|
} |
688
|
|
|
|
689
|
|
|
|
690
|
|
|
|
691
|
|
|
/** |
692
|
|
|
* @param AMQPReader $args |
693
|
|
|
* @return array |
694
|
|
|
*/ |
695
|
|
|
public static function basicGetEmpty($args) |
696
|
|
|
{ |
697
|
|
|
$ret = array(); |
698
|
|
|
$ret[] = $args->read_shortstr(); |
699
|
|
|
return $ret; |
700
|
|
|
} |
701
|
|
|
|
702
|
|
|
|
703
|
|
|
|
704
|
|
|
/** |
705
|
|
|
* @return array |
706
|
|
|
*/ |
707
|
20 |
View Code Duplication |
public function basicAck($delivery_tag = 0, $multiple = false) |
|
|
|
|
708
|
|
|
{ |
709
|
20 |
|
$args = new AMQPWriter(); |
710
|
20 |
|
$args->write_longlong($delivery_tag); |
711
|
20 |
|
$args->write_bits(array($multiple)); |
712
|
20 |
|
return array(60, 80, $args); |
713
|
|
|
} |
714
|
|
|
|
715
|
|
|
|
716
|
|
|
|
717
|
|
|
/** |
718
|
|
|
* @return array |
719
|
|
|
*/ |
720
|
5 |
View Code Duplication |
public function basicReject($delivery_tag, $requeue = true) |
|
|
|
|
721
|
|
|
{ |
722
|
5 |
|
$args = new AMQPWriter(); |
723
|
5 |
|
$args->write_longlong($delivery_tag); |
724
|
5 |
|
$args->write_bits(array($requeue)); |
725
|
5 |
|
return array(60, 90, $args); |
726
|
|
|
} |
727
|
|
|
|
728
|
|
|
|
729
|
|
|
|
730
|
|
|
/** |
731
|
|
|
* @return array |
732
|
|
|
*/ |
733
|
|
|
public function basicRecoverAsync($requeue = false) |
734
|
|
|
{ |
735
|
|
|
$args = new AMQPWriter(); |
736
|
|
|
$args->write_bits(array($requeue)); |
737
|
|
|
return array(60, 100, $args); |
738
|
|
|
} |
739
|
|
|
|
740
|
|
|
|
741
|
|
|
|
742
|
|
|
/** |
743
|
|
|
* @return array |
744
|
|
|
*/ |
745
|
5 |
|
public function basicRecover($requeue = false) |
746
|
|
|
{ |
747
|
5 |
|
$args = new AMQPWriter(); |
748
|
5 |
|
$args->write_bits(array($requeue)); |
749
|
5 |
|
return array(60, 110, $args); |
750
|
|
|
} |
751
|
|
|
|
752
|
|
|
|
753
|
|
|
|
754
|
|
|
/** |
755
|
|
|
* @param AMQPReader $args |
756
|
|
|
* @return array |
757
|
|
|
*/ |
758
|
|
|
public static function basicRecoverOk($args) |
|
|
|
|
759
|
|
|
{ |
760
|
|
|
$ret = array(); |
761
|
|
|
return $ret; |
762
|
|
|
} |
763
|
|
|
|
764
|
|
|
|
765
|
|
|
|
766
|
|
|
/** |
767
|
|
|
* @return array |
768
|
|
|
*/ |
769
|
|
View Code Duplication |
public function basicNack($delivery_tag = 0, $multiple = false, $requeue = true) |
|
|
|
|
770
|
|
|
{ |
771
|
|
|
$args = new AMQPWriter(); |
772
|
|
|
$args->write_longlong($delivery_tag); |
773
|
|
|
$args->write_bits(array($multiple, $requeue)); |
774
|
|
|
return array(60, 120, $args); |
775
|
|
|
} |
776
|
|
|
|
777
|
|
|
|
778
|
|
|
|
779
|
|
|
/** |
780
|
|
|
* @return array |
781
|
|
|
*/ |
782
|
|
|
public function txSelect() |
783
|
|
|
{ |
784
|
|
|
$args = new AMQPWriter(); |
785
|
|
|
return array(90, 10, $args); |
786
|
|
|
} |
787
|
|
|
|
788
|
|
|
|
789
|
|
|
|
790
|
|
|
/** |
791
|
|
|
* @param AMQPReader $args |
792
|
|
|
* @return array |
793
|
|
|
*/ |
794
|
|
|
public static function txSelectOk($args) |
|
|
|
|
795
|
|
|
{ |
796
|
|
|
$ret = array(); |
797
|
|
|
return $ret; |
798
|
|
|
} |
799
|
|
|
|
800
|
|
|
|
801
|
|
|
|
802
|
|
|
/** |
803
|
|
|
* @return array |
804
|
|
|
*/ |
805
|
|
|
public function txCommit() |
806
|
|
|
{ |
807
|
|
|
$args = new AMQPWriter(); |
808
|
|
|
return array(90, 20, $args); |
809
|
|
|
} |
810
|
|
|
|
811
|
|
|
|
812
|
|
|
|
813
|
|
|
/** |
814
|
|
|
* @param AMQPReader $args |
815
|
|
|
* @return array |
816
|
|
|
*/ |
817
|
|
|
public static function txCommitOk($args) |
|
|
|
|
818
|
|
|
{ |
819
|
|
|
$ret = array(); |
820
|
|
|
return $ret; |
821
|
|
|
} |
822
|
|
|
|
823
|
|
|
|
824
|
|
|
|
825
|
|
|
/** |
826
|
|
|
* @return array |
827
|
|
|
*/ |
828
|
|
|
public function txRollback() |
829
|
|
|
{ |
830
|
|
|
$args = new AMQPWriter(); |
831
|
|
|
return array(90, 30, $args); |
832
|
|
|
} |
833
|
|
|
|
834
|
|
|
|
835
|
|
|
|
836
|
|
|
/** |
837
|
|
|
* @param AMQPReader $args |
838
|
|
|
* @return array |
839
|
|
|
*/ |
840
|
|
|
public static function txRollbackOk($args) |
|
|
|
|
841
|
|
|
{ |
842
|
|
|
$ret = array(); |
843
|
|
|
return $ret; |
844
|
|
|
} |
845
|
|
|
|
846
|
|
|
|
847
|
|
|
|
848
|
|
|
/** |
849
|
|
|
* @return array |
850
|
|
|
*/ |
851
|
|
|
public function confirmSelect($nowait = false) |
852
|
|
|
{ |
853
|
|
|
$args = new AMQPWriter(); |
854
|
|
|
$args->write_bits(array($nowait)); |
855
|
|
|
return array(85, 10, $args); |
856
|
|
|
} |
857
|
|
|
|
858
|
|
|
|
859
|
|
|
|
860
|
|
|
/** |
861
|
|
|
* @param AMQPReader $args |
862
|
|
|
* @return array |
863
|
|
|
*/ |
864
|
|
|
public static function confirmSelectOk($args) |
|
|
|
|
865
|
|
|
{ |
866
|
|
|
$ret = array(); |
867
|
|
|
return $ret; |
868
|
|
|
} |
869
|
|
|
|
870
|
|
|
} |
871
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.