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 Protocol080 |
11
|
|
|
{ |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @return array |
15
|
|
|
*/ |
16
|
|
|
public function connectionStart($version_major = 0, $version_minor = 8, $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
|
|
|
public function connectionRedirect($host, $known_hosts = '') |
130
|
|
|
{ |
131
|
|
|
$args = new AMQPWriter(); |
132
|
|
|
$args->write_shortstr($host); |
133
|
|
|
$args->write_shortstr($known_hosts); |
134
|
|
|
return array(10, 50, $args); |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
|
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @return array |
141
|
|
|
*/ |
142
|
|
View Code Duplication |
public function connectionClose($reply_code, $reply_text = '', $class_id, $method_id) |
|
|
|
|
143
|
|
|
{ |
144
|
|
|
$args = new AMQPWriter(); |
145
|
|
|
$args->write_short($reply_code); |
146
|
|
|
$args->write_shortstr($reply_text); |
147
|
|
|
$args->write_short($class_id); |
148
|
|
|
$args->write_short($method_id); |
149
|
|
|
return array(10, 60, $args); |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
|
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* @param AMQPReader $args |
156
|
|
|
* @return array |
157
|
|
|
*/ |
158
|
|
|
public static function connectionCloseOk($args) |
|
|
|
|
159
|
|
|
{ |
160
|
|
|
$ret = array(); |
161
|
|
|
return $ret; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
|
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* @return array |
168
|
|
|
*/ |
169
|
|
|
public function channelOpen($out_of_band = '') |
170
|
|
|
{ |
171
|
|
|
$args = new AMQPWriter(); |
172
|
|
|
$args->write_shortstr($out_of_band); |
173
|
|
|
return array(20, 10, $args); |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
|
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* @param AMQPReader $args |
180
|
|
|
* @return array |
181
|
|
|
*/ |
182
|
|
|
public static function channelOpenOk($args) |
|
|
|
|
183
|
|
|
{ |
184
|
|
|
$ret = array(); |
185
|
|
|
return $ret; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
|
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* @return array |
192
|
|
|
*/ |
193
|
|
|
public function channelFlow($active) |
194
|
|
|
{ |
195
|
|
|
$args = new AMQPWriter(); |
196
|
|
|
$args->write_bits(array($active)); |
197
|
|
|
return array(20, 20, $args); |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
|
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* @param AMQPReader $args |
204
|
|
|
* @return array |
205
|
|
|
*/ |
206
|
|
|
public static function channelFlowOk($args) |
207
|
|
|
{ |
208
|
|
|
$ret = array(); |
209
|
|
|
$ret[] = $args->read_bit(); |
210
|
|
|
return $ret; |
211
|
|
|
} |
212
|
|
|
|
213
|
|
|
|
214
|
|
|
|
215
|
|
|
/** |
216
|
|
|
* @return array |
217
|
|
|
*/ |
218
|
|
|
public function channelAlert($reply_code, $reply_text = '', $details = array()) |
219
|
|
|
{ |
220
|
|
|
$args = new AMQPWriter(); |
221
|
|
|
$args->write_short($reply_code); |
222
|
|
|
$args->write_shortstr($reply_text); |
223
|
|
|
$args->write_table(empty($details) ? array() : $details); |
224
|
|
|
return array(20, 30, $args); |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
|
228
|
|
|
|
229
|
|
|
/** |
230
|
|
|
* @return array |
231
|
|
|
*/ |
232
|
|
View Code Duplication |
public function channelClose($reply_code, $reply_text = '', $class_id, $method_id) |
|
|
|
|
233
|
|
|
{ |
234
|
|
|
$args = new AMQPWriter(); |
235
|
|
|
$args->write_short($reply_code); |
236
|
|
|
$args->write_shortstr($reply_text); |
237
|
|
|
$args->write_short($class_id); |
238
|
|
|
$args->write_short($method_id); |
239
|
|
|
return array(20, 40, $args); |
240
|
|
|
} |
241
|
|
|
|
242
|
|
|
|
243
|
|
|
|
244
|
|
|
/** |
245
|
|
|
* @param AMQPReader $args |
246
|
|
|
* @return array |
247
|
|
|
*/ |
248
|
|
|
public static function channelCloseOk($args) |
|
|
|
|
249
|
|
|
{ |
250
|
|
|
$ret = array(); |
251
|
|
|
return $ret; |
252
|
|
|
} |
253
|
|
|
|
254
|
|
|
|
255
|
|
|
|
256
|
|
|
/** |
257
|
|
|
* @return array |
258
|
|
|
*/ |
259
|
|
View Code Duplication |
public function accessRequest($realm = '/data', $exclusive = false, $passive = true, $active = true, $write = true, $read = true) |
|
|
|
|
260
|
|
|
{ |
261
|
|
|
$args = new AMQPWriter(); |
262
|
|
|
$args->write_shortstr($realm); |
263
|
|
|
$args->write_bits(array($exclusive, $passive, $active, $write, $read)); |
264
|
|
|
return array(30, 10, $args); |
265
|
|
|
} |
266
|
|
|
|
267
|
|
|
|
268
|
|
|
|
269
|
|
|
/** |
270
|
|
|
* @param AMQPReader $args |
271
|
|
|
* @return array |
272
|
|
|
*/ |
273
|
|
|
public static function accessRequestOk($args) |
274
|
|
|
{ |
275
|
|
|
$ret = array(); |
276
|
|
|
$ret[] = $args->read_short(); |
277
|
|
|
return $ret; |
278
|
|
|
} |
279
|
|
|
|
280
|
|
|
|
281
|
|
|
|
282
|
|
|
/** |
283
|
|
|
* @return array |
284
|
|
|
*/ |
285
|
|
View Code Duplication |
public function exchangeDeclare($ticket = 1, $exchange, $type = 'direct', $passive = false, $durable = false, $auto_delete = false, $internal = false, $nowait = false, $arguments = array()) |
|
|
|
|
286
|
|
|
{ |
287
|
|
|
$args = new AMQPWriter(); |
288
|
|
|
$args->write_short($ticket); |
289
|
|
|
$args->write_shortstr($exchange); |
290
|
|
|
$args->write_shortstr($type); |
291
|
|
|
$args->write_bits(array($passive, $durable, $auto_delete, $internal, $nowait)); |
292
|
|
|
$args->write_table(empty($arguments) ? array() : $arguments); |
293
|
|
|
return array(40, 10, $args); |
294
|
|
|
} |
295
|
|
|
|
296
|
|
|
|
297
|
|
|
|
298
|
|
|
/** |
299
|
|
|
* @param AMQPReader $args |
300
|
|
|
* @return array |
301
|
|
|
*/ |
302
|
|
|
public static function exchangeDeclareOk($args) |
|
|
|
|
303
|
|
|
{ |
304
|
|
|
$ret = array(); |
305
|
|
|
return $ret; |
306
|
|
|
} |
307
|
|
|
|
308
|
|
|
|
309
|
|
|
|
310
|
|
|
/** |
311
|
|
|
* @return array |
312
|
|
|
*/ |
313
|
|
|
public function exchangeDelete($ticket = 1, $exchange, $if_unused = false, $nowait = false) |
314
|
|
|
{ |
315
|
|
|
$args = new AMQPWriter(); |
316
|
|
|
$args->write_short($ticket); |
317
|
|
|
$args->write_shortstr($exchange); |
318
|
|
|
$args->write_bits(array($if_unused, $nowait)); |
319
|
|
|
return array(40, 20, $args); |
320
|
|
|
} |
321
|
|
|
|
322
|
|
|
|
323
|
|
|
|
324
|
|
|
/** |
325
|
|
|
* @param AMQPReader $args |
326
|
|
|
* @return array |
327
|
|
|
*/ |
328
|
|
|
public static function exchangeDeleteOk($args) |
|
|
|
|
329
|
|
|
{ |
330
|
|
|
$ret = array(); |
331
|
|
|
return $ret; |
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
|
335
|
|
|
|
336
|
|
|
/** |
337
|
|
|
* @return array |
338
|
|
|
*/ |
339
|
|
View Code Duplication |
public function queueDeclare($ticket = 1, $queue = '', $passive = false, $durable = false, $exclusive = false, $auto_delete = false, $nowait = false, $arguments = array()) |
|
|
|
|
340
|
|
|
{ |
341
|
|
|
$args = new AMQPWriter(); |
342
|
|
|
$args->write_short($ticket); |
343
|
|
|
$args->write_shortstr($queue); |
344
|
|
|
$args->write_bits(array($passive, $durable, $exclusive, $auto_delete, $nowait)); |
345
|
|
|
$args->write_table(empty($arguments) ? array() : $arguments); |
346
|
|
|
return array(50, 10, $args); |
347
|
|
|
} |
348
|
|
|
|
349
|
|
|
|
350
|
|
|
|
351
|
|
|
/** |
352
|
|
|
* @param AMQPReader $args |
353
|
|
|
* @return array |
354
|
|
|
*/ |
355
|
|
View Code Duplication |
public static function queueDeclareOk($args) |
|
|
|
|
356
|
|
|
{ |
357
|
|
|
$ret = array(); |
358
|
|
|
$ret[] = $args->read_shortstr(); |
359
|
|
|
$ret[] = $args->read_long(); |
360
|
|
|
$ret[] = $args->read_long(); |
361
|
|
|
return $ret; |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
|
365
|
|
|
|
366
|
|
|
/** |
367
|
|
|
* @return array |
368
|
|
|
*/ |
369
|
|
View Code Duplication |
public function queueBind($ticket = 1, $queue = '', $exchange, $routing_key = '', $nowait = false, $arguments = array()) |
|
|
|
|
370
|
|
|
{ |
371
|
|
|
$args = new AMQPWriter(); |
372
|
|
|
$args->write_short($ticket); |
373
|
|
|
$args->write_shortstr($queue); |
374
|
|
|
$args->write_shortstr($exchange); |
375
|
|
|
$args->write_shortstr($routing_key); |
376
|
|
|
$args->write_bits(array($nowait)); |
377
|
|
|
$args->write_table(empty($arguments) ? array() : $arguments); |
378
|
|
|
return array(50, 20, $args); |
379
|
|
|
} |
380
|
|
|
|
381
|
|
|
|
382
|
|
|
|
383
|
|
|
/** |
384
|
|
|
* @param AMQPReader $args |
385
|
|
|
* @return array |
386
|
|
|
*/ |
387
|
|
|
public static function queueBindOk($args) |
|
|
|
|
388
|
|
|
{ |
389
|
|
|
$ret = array(); |
390
|
|
|
return $ret; |
391
|
|
|
} |
392
|
|
|
|
393
|
|
|
|
394
|
|
|
|
395
|
|
|
/** |
396
|
|
|
* @return array |
397
|
|
|
*/ |
398
|
|
View Code Duplication |
public function queuePurge($ticket = 1, $queue = '', $nowait = false) |
|
|
|
|
399
|
|
|
{ |
400
|
|
|
$args = new AMQPWriter(); |
401
|
|
|
$args->write_short($ticket); |
402
|
|
|
$args->write_shortstr($queue); |
403
|
|
|
$args->write_bits(array($nowait)); |
404
|
|
|
return array(50, 30, $args); |
405
|
|
|
} |
406
|
|
|
|
407
|
|
|
|
408
|
|
|
|
409
|
|
|
/** |
410
|
|
|
* @param AMQPReader $args |
411
|
|
|
* @return array |
412
|
|
|
*/ |
413
|
|
|
public static function queuePurgeOk($args) |
414
|
|
|
{ |
415
|
|
|
$ret = array(); |
416
|
|
|
$ret[] = $args->read_long(); |
417
|
|
|
return $ret; |
418
|
|
|
} |
419
|
|
|
|
420
|
|
|
|
421
|
|
|
|
422
|
|
|
/** |
423
|
|
|
* @return array |
424
|
|
|
*/ |
425
|
|
|
public function queueDelete($ticket = 1, $queue = '', $if_unused = false, $if_empty = false, $nowait = false) |
426
|
|
|
{ |
427
|
|
|
$args = new AMQPWriter(); |
428
|
|
|
$args->write_short($ticket); |
429
|
|
|
$args->write_shortstr($queue); |
430
|
|
|
$args->write_bits(array($if_unused, $if_empty, $nowait)); |
431
|
|
|
return array(50, 40, $args); |
432
|
|
|
} |
433
|
|
|
|
434
|
|
|
|
435
|
|
|
|
436
|
|
|
/** |
437
|
|
|
* @param AMQPReader $args |
438
|
|
|
* @return array |
439
|
|
|
*/ |
440
|
|
|
public static function queueDeleteOk($args) |
441
|
|
|
{ |
442
|
|
|
$ret = array(); |
443
|
|
|
$ret[] = $args->read_long(); |
444
|
|
|
return $ret; |
445
|
|
|
} |
446
|
|
|
|
447
|
|
|
|
448
|
|
|
|
449
|
|
|
/** |
450
|
|
|
* @return array |
451
|
|
|
*/ |
452
|
|
View Code Duplication |
public function queueUnbind($ticket = 1, $queue = '', $exchange, $routing_key = '', $arguments = array()) |
|
|
|
|
453
|
|
|
{ |
454
|
|
|
$args = new AMQPWriter(); |
455
|
|
|
$args->write_short($ticket); |
456
|
|
|
$args->write_shortstr($queue); |
457
|
|
|
$args->write_shortstr($exchange); |
458
|
|
|
$args->write_shortstr($routing_key); |
459
|
|
|
$args->write_table(empty($arguments) ? array() : $arguments); |
460
|
|
|
return array(50, 50, $args); |
461
|
|
|
} |
462
|
|
|
|
463
|
|
|
|
464
|
|
|
|
465
|
|
|
/** |
466
|
|
|
* @param AMQPReader $args |
467
|
|
|
* @return array |
468
|
|
|
*/ |
469
|
|
|
public static function queueUnbindOk($args) |
|
|
|
|
470
|
|
|
{ |
471
|
|
|
$ret = array(); |
472
|
|
|
return $ret; |
473
|
|
|
} |
474
|
|
|
|
475
|
|
|
|
476
|
|
|
|
477
|
|
|
/** |
478
|
|
|
* @return array |
479
|
|
|
*/ |
480
|
|
View Code Duplication |
public function basicQos($prefetch_size = 0, $prefetch_count = 0, $global = false) |
|
|
|
|
481
|
|
|
{ |
482
|
|
|
$args = new AMQPWriter(); |
483
|
|
|
$args->write_long($prefetch_size); |
484
|
|
|
$args->write_short($prefetch_count); |
485
|
|
|
$args->write_bits(array($global)); |
486
|
|
|
return array(60, 10, $args); |
487
|
|
|
} |
488
|
|
|
|
489
|
|
|
|
490
|
|
|
|
491
|
|
|
/** |
492
|
|
|
* @param AMQPReader $args |
493
|
|
|
* @return array |
494
|
|
|
*/ |
495
|
|
|
public static function basicQosOk($args) |
|
|
|
|
496
|
|
|
{ |
497
|
|
|
$ret = array(); |
498
|
|
|
return $ret; |
499
|
|
|
} |
500
|
|
|
|
501
|
|
|
|
502
|
|
|
|
503
|
|
|
/** |
504
|
|
|
* @return array |
505
|
|
|
*/ |
506
|
|
|
public function basicConsume($ticket = 1, $queue = '', $consumer_tag = '', $no_local = false, $no_ack = false, $exclusive = false, $nowait = false) |
507
|
|
|
{ |
508
|
|
|
$args = new AMQPWriter(); |
509
|
|
|
$args->write_short($ticket); |
510
|
|
|
$args->write_shortstr($queue); |
511
|
|
|
$args->write_shortstr($consumer_tag); |
512
|
|
|
$args->write_bits(array($no_local, $no_ack, $exclusive, $nowait)); |
513
|
|
|
return array(60, 20, $args); |
514
|
|
|
} |
515
|
|
|
|
516
|
|
|
|
517
|
|
|
|
518
|
|
|
/** |
519
|
|
|
* @param AMQPReader $args |
520
|
|
|
* @return array |
521
|
|
|
*/ |
522
|
|
|
public static function basicConsumeOk($args) |
523
|
|
|
{ |
524
|
|
|
$ret = array(); |
525
|
|
|
$ret[] = $args->read_shortstr(); |
526
|
|
|
return $ret; |
527
|
|
|
} |
528
|
|
|
|
529
|
|
|
|
530
|
|
|
|
531
|
|
|
/** |
532
|
|
|
* @return array |
533
|
|
|
*/ |
534
|
|
View Code Duplication |
public function basicCancel($consumer_tag, $nowait = false) |
|
|
|
|
535
|
|
|
{ |
536
|
|
|
$args = new AMQPWriter(); |
537
|
|
|
$args->write_shortstr($consumer_tag); |
538
|
|
|
$args->write_bits(array($nowait)); |
539
|
|
|
return array(60, 30, $args); |
540
|
|
|
} |
541
|
|
|
|
542
|
|
|
|
543
|
|
|
|
544
|
|
|
/** |
545
|
|
|
* @param AMQPReader $args |
546
|
|
|
* @return array |
547
|
|
|
*/ |
548
|
|
|
public static function basicCancelOk($args) |
549
|
|
|
{ |
550
|
|
|
$ret = array(); |
551
|
|
|
$ret[] = $args->read_shortstr(); |
552
|
|
|
return $ret; |
553
|
|
|
} |
554
|
|
|
|
555
|
|
|
|
556
|
|
|
|
557
|
|
|
/** |
558
|
|
|
* @return array |
559
|
|
|
*/ |
560
|
|
View Code Duplication |
public function basicPublish($ticket = 1, $exchange = '', $routing_key = '', $mandatory = false, $immediate = false) |
|
|
|
|
561
|
|
|
{ |
562
|
|
|
$args = new AMQPWriter(); |
563
|
|
|
$args->write_short($ticket); |
564
|
|
|
$args->write_shortstr($exchange); |
565
|
|
|
$args->write_shortstr($routing_key); |
566
|
|
|
$args->write_bits(array($mandatory, $immediate)); |
567
|
|
|
return array(60, 40, $args); |
568
|
|
|
} |
569
|
|
|
|
570
|
|
|
|
571
|
|
|
|
572
|
|
|
/** |
573
|
|
|
* @return array |
574
|
|
|
*/ |
575
|
|
View Code Duplication |
public function basicReturn($reply_code, $reply_text = '', $exchange, $routing_key) |
|
|
|
|
576
|
|
|
{ |
577
|
|
|
$args = new AMQPWriter(); |
578
|
|
|
$args->write_short($reply_code); |
579
|
|
|
$args->write_shortstr($reply_text); |
580
|
|
|
$args->write_shortstr($exchange); |
581
|
|
|
$args->write_shortstr($routing_key); |
582
|
|
|
return array(60, 50, $args); |
583
|
|
|
} |
584
|
|
|
|
585
|
|
|
|
586
|
|
|
|
587
|
|
|
/** |
588
|
|
|
* @return array |
589
|
|
|
*/ |
590
|
|
View Code Duplication |
public function basicDeliver($consumer_tag, $delivery_tag, $redelivered = false, $exchange, $routing_key) |
|
|
|
|
591
|
|
|
{ |
592
|
|
|
$args = new AMQPWriter(); |
593
|
|
|
$args->write_shortstr($consumer_tag); |
594
|
|
|
$args->write_longlong($delivery_tag); |
595
|
|
|
$args->write_bits(array($redelivered)); |
596
|
|
|
$args->write_shortstr($exchange); |
597
|
|
|
$args->write_shortstr($routing_key); |
598
|
|
|
return array(60, 60, $args); |
599
|
|
|
} |
600
|
|
|
|
601
|
|
|
|
602
|
|
|
|
603
|
|
|
/** |
604
|
|
|
* @return array |
605
|
|
|
*/ |
606
|
|
|
public function basicGet($ticket = 1, $queue = '', $no_ack = false) |
607
|
|
|
{ |
608
|
|
|
$args = new AMQPWriter(); |
609
|
|
|
$args->write_short($ticket); |
610
|
|
|
$args->write_shortstr($queue); |
611
|
|
|
$args->write_bits(array($no_ack)); |
612
|
|
|
return array(60, 70, $args); |
613
|
|
|
} |
614
|
|
|
|
615
|
|
|
|
616
|
|
|
|
617
|
|
|
/** |
618
|
|
|
* @param AMQPReader $args |
619
|
|
|
* @return array |
620
|
|
|
*/ |
621
|
|
View Code Duplication |
public static function basicGetOk($args) |
|
|
|
|
622
|
|
|
{ |
623
|
|
|
$ret = array(); |
624
|
|
|
$ret[] = $args->read_longlong(); |
625
|
|
|
$ret[] = $args->read_bit(); |
626
|
|
|
$ret[] = $args->read_shortstr(); |
627
|
|
|
$ret[] = $args->read_shortstr(); |
628
|
|
|
$ret[] = $args->read_long(); |
629
|
|
|
return $ret; |
630
|
|
|
} |
631
|
|
|
|
632
|
|
|
|
633
|
|
|
|
634
|
|
|
/** |
635
|
|
|
* @param AMQPReader $args |
636
|
|
|
* @return array |
637
|
|
|
*/ |
638
|
|
|
public static function basicGetEmpty($args) |
639
|
|
|
{ |
640
|
|
|
$ret = array(); |
641
|
|
|
$ret[] = $args->read_shortstr(); |
642
|
|
|
return $ret; |
643
|
|
|
} |
644
|
|
|
|
645
|
|
|
|
646
|
|
|
|
647
|
|
|
/** |
648
|
|
|
* @return array |
649
|
|
|
*/ |
650
|
|
View Code Duplication |
public function basicAck($delivery_tag = 0, $multiple = false) |
|
|
|
|
651
|
|
|
{ |
652
|
|
|
$args = new AMQPWriter(); |
653
|
|
|
$args->write_longlong($delivery_tag); |
654
|
|
|
$args->write_bits(array($multiple)); |
655
|
|
|
return array(60, 80, $args); |
656
|
|
|
} |
657
|
|
|
|
658
|
|
|
|
659
|
|
|
|
660
|
|
|
/** |
661
|
|
|
* @return array |
662
|
|
|
*/ |
663
|
|
View Code Duplication |
public function basicReject($delivery_tag, $requeue = true) |
|
|
|
|
664
|
|
|
{ |
665
|
|
|
$args = new AMQPWriter(); |
666
|
|
|
$args->write_longlong($delivery_tag); |
667
|
|
|
$args->write_bits(array($requeue)); |
668
|
|
|
return array(60, 90, $args); |
669
|
|
|
} |
670
|
|
|
|
671
|
|
|
|
672
|
|
|
|
673
|
|
|
/** |
674
|
|
|
* @return array |
675
|
|
|
*/ |
676
|
|
|
public function basicRecoverAsync($requeue = false) |
677
|
|
|
{ |
678
|
|
|
$args = new AMQPWriter(); |
679
|
|
|
$args->write_bits(array($requeue)); |
680
|
|
|
return array(60, 100, $args); |
681
|
|
|
} |
682
|
|
|
|
683
|
|
|
|
684
|
|
|
|
685
|
|
|
/** |
686
|
|
|
* @return array |
687
|
|
|
*/ |
688
|
|
|
public function basicRecover($requeue = false) |
689
|
|
|
{ |
690
|
|
|
$args = new AMQPWriter(); |
691
|
|
|
$args->write_bits(array($requeue)); |
692
|
|
|
return array(60, 110, $args); |
693
|
|
|
} |
694
|
|
|
|
695
|
|
|
|
696
|
|
|
|
697
|
|
|
/** |
698
|
|
|
* @param AMQPReader $args |
699
|
|
|
* @return array |
700
|
|
|
*/ |
701
|
|
|
public static function basicRecoverOk($args) |
|
|
|
|
702
|
|
|
{ |
703
|
|
|
$ret = array(); |
704
|
|
|
return $ret; |
705
|
|
|
} |
706
|
|
|
|
707
|
|
|
|
708
|
|
|
|
709
|
|
|
/** |
710
|
|
|
* @return array |
711
|
|
|
*/ |
712
|
|
View Code Duplication |
public function fileQos($prefetch_size = 0, $prefetch_count = 0, $global = false) |
|
|
|
|
713
|
|
|
{ |
714
|
|
|
$args = new AMQPWriter(); |
715
|
|
|
$args->write_long($prefetch_size); |
716
|
|
|
$args->write_short($prefetch_count); |
717
|
|
|
$args->write_bits(array($global)); |
718
|
|
|
return array(70, 10, $args); |
719
|
|
|
} |
720
|
|
|
|
721
|
|
|
|
722
|
|
|
|
723
|
|
|
/** |
724
|
|
|
* @param AMQPReader $args |
725
|
|
|
* @return array |
726
|
|
|
*/ |
727
|
|
|
public static function fileQosOk($args) |
|
|
|
|
728
|
|
|
{ |
729
|
|
|
$ret = array(); |
730
|
|
|
return $ret; |
731
|
|
|
} |
732
|
|
|
|
733
|
|
|
|
734
|
|
|
|
735
|
|
|
/** |
736
|
|
|
* @return array |
737
|
|
|
*/ |
738
|
|
|
public function fileConsume($ticket = 1, $queue = '', $consumer_tag = '', $no_local = false, $no_ack = false, $exclusive = false, $nowait = false) |
739
|
|
|
{ |
740
|
|
|
$args = new AMQPWriter(); |
741
|
|
|
$args->write_short($ticket); |
742
|
|
|
$args->write_shortstr($queue); |
743
|
|
|
$args->write_shortstr($consumer_tag); |
744
|
|
|
$args->write_bits(array($no_local, $no_ack, $exclusive, $nowait)); |
745
|
|
|
return array(70, 20, $args); |
746
|
|
|
} |
747
|
|
|
|
748
|
|
|
|
749
|
|
|
|
750
|
|
|
/** |
751
|
|
|
* @param AMQPReader $args |
752
|
|
|
* @return array |
753
|
|
|
*/ |
754
|
|
|
public static function fileConsumeOk($args) |
755
|
|
|
{ |
756
|
|
|
$ret = array(); |
757
|
|
|
$ret[] = $args->read_shortstr(); |
758
|
|
|
return $ret; |
759
|
|
|
} |
760
|
|
|
|
761
|
|
|
|
762
|
|
|
|
763
|
|
|
/** |
764
|
|
|
* @return array |
765
|
|
|
*/ |
766
|
|
View Code Duplication |
public function fileCancel($consumer_tag, $nowait = false) |
|
|
|
|
767
|
|
|
{ |
768
|
|
|
$args = new AMQPWriter(); |
769
|
|
|
$args->write_shortstr($consumer_tag); |
770
|
|
|
$args->write_bits(array($nowait)); |
771
|
|
|
return array(70, 30, $args); |
772
|
|
|
} |
773
|
|
|
|
774
|
|
|
|
775
|
|
|
|
776
|
|
|
/** |
777
|
|
|
* @param AMQPReader $args |
778
|
|
|
* @return array |
779
|
|
|
*/ |
780
|
|
|
public static function fileCancelOk($args) |
781
|
|
|
{ |
782
|
|
|
$ret = array(); |
783
|
|
|
$ret[] = $args->read_shortstr(); |
784
|
|
|
return $ret; |
785
|
|
|
} |
786
|
|
|
|
787
|
|
|
|
788
|
|
|
|
789
|
|
|
/** |
790
|
|
|
* @return array |
791
|
|
|
*/ |
792
|
|
|
public function fileOpen($identifier, $content_size) |
793
|
|
|
{ |
794
|
|
|
$args = new AMQPWriter(); |
795
|
|
|
$args->write_shortstr($identifier); |
796
|
|
|
$args->write_longlong($content_size); |
797
|
|
|
return array(70, 40, $args); |
798
|
|
|
} |
799
|
|
|
|
800
|
|
|
|
801
|
|
|
|
802
|
|
|
/** |
803
|
|
|
* @param AMQPReader $args |
804
|
|
|
* @return array |
805
|
|
|
*/ |
806
|
|
|
public static function fileOpenOk($args) |
807
|
|
|
{ |
808
|
|
|
$ret = array(); |
809
|
|
|
$ret[] = $args->read_longlong(); |
810
|
|
|
return $ret; |
811
|
|
|
} |
812
|
|
|
|
813
|
|
|
|
814
|
|
|
|
815
|
|
|
/** |
816
|
|
|
* @return array |
817
|
|
|
*/ |
818
|
|
|
public function fileStage() |
819
|
|
|
{ |
820
|
|
|
$args = new AMQPWriter(); |
821
|
|
|
return array(70, 50, $args); |
822
|
|
|
} |
823
|
|
|
|
824
|
|
|
|
825
|
|
|
|
826
|
|
|
/** |
827
|
|
|
* @return array |
828
|
|
|
*/ |
829
|
|
View Code Duplication |
public function filePublish($ticket = 1, $exchange = '', $routing_key = '', $mandatory = false, $immediate = false, $identifier) |
|
|
|
|
830
|
|
|
{ |
831
|
|
|
$args = new AMQPWriter(); |
832
|
|
|
$args->write_short($ticket); |
833
|
|
|
$args->write_shortstr($exchange); |
834
|
|
|
$args->write_shortstr($routing_key); |
835
|
|
|
$args->write_bits(array($mandatory, $immediate)); |
836
|
|
|
$args->write_shortstr($identifier); |
837
|
|
|
return array(70, 60, $args); |
838
|
|
|
} |
839
|
|
|
|
840
|
|
|
|
841
|
|
|
|
842
|
|
|
/** |
843
|
|
|
* @return array |
844
|
|
|
*/ |
845
|
|
View Code Duplication |
public function fileReturn($reply_code = 200, $reply_text = '', $exchange, $routing_key) |
|
|
|
|
846
|
|
|
{ |
847
|
|
|
$args = new AMQPWriter(); |
848
|
|
|
$args->write_short($reply_code); |
849
|
|
|
$args->write_shortstr($reply_text); |
850
|
|
|
$args->write_shortstr($exchange); |
851
|
|
|
$args->write_shortstr($routing_key); |
852
|
|
|
return array(70, 70, $args); |
853
|
|
|
} |
854
|
|
|
|
855
|
|
|
|
856
|
|
|
|
857
|
|
|
/** |
858
|
|
|
* @return array |
859
|
|
|
*/ |
860
|
|
View Code Duplication |
public function fileDeliver($consumer_tag, $delivery_tag, $redelivered = false, $exchange, $routing_key, $identifier) |
|
|
|
|
861
|
|
|
{ |
862
|
|
|
$args = new AMQPWriter(); |
863
|
|
|
$args->write_shortstr($consumer_tag); |
864
|
|
|
$args->write_longlong($delivery_tag); |
865
|
|
|
$args->write_bits(array($redelivered)); |
866
|
|
|
$args->write_shortstr($exchange); |
867
|
|
|
$args->write_shortstr($routing_key); |
868
|
|
|
$args->write_shortstr($identifier); |
869
|
|
|
return array(70, 80, $args); |
870
|
|
|
} |
871
|
|
|
|
872
|
|
|
|
873
|
|
|
|
874
|
|
|
/** |
875
|
|
|
* @return array |
876
|
|
|
*/ |
877
|
|
View Code Duplication |
public function fileAck($delivery_tag = 0, $multiple = false) |
|
|
|
|
878
|
|
|
{ |
879
|
|
|
$args = new AMQPWriter(); |
880
|
|
|
$args->write_longlong($delivery_tag); |
881
|
|
|
$args->write_bits(array($multiple)); |
882
|
|
|
return array(70, 90, $args); |
883
|
|
|
} |
884
|
|
|
|
885
|
|
|
|
886
|
|
|
|
887
|
|
|
/** |
888
|
|
|
* @return array |
889
|
|
|
*/ |
890
|
|
View Code Duplication |
public function fileReject($delivery_tag, $requeue = true) |
|
|
|
|
891
|
|
|
{ |
892
|
|
|
$args = new AMQPWriter(); |
893
|
|
|
$args->write_longlong($delivery_tag); |
894
|
|
|
$args->write_bits(array($requeue)); |
895
|
|
|
return array(70, 100, $args); |
896
|
|
|
} |
897
|
|
|
|
898
|
|
|
|
899
|
|
|
|
900
|
|
|
/** |
901
|
|
|
* @return array |
902
|
|
|
*/ |
903
|
|
View Code Duplication |
public function streamQos($prefetch_size = 0, $prefetch_count = 0, $consume_rate = 0, $global = false) |
|
|
|
|
904
|
|
|
{ |
905
|
|
|
$args = new AMQPWriter(); |
906
|
|
|
$args->write_long($prefetch_size); |
907
|
|
|
$args->write_short($prefetch_count); |
908
|
|
|
$args->write_long($consume_rate); |
909
|
|
|
$args->write_bits(array($global)); |
910
|
|
|
return array(80, 10, $args); |
911
|
|
|
} |
912
|
|
|
|
913
|
|
|
|
914
|
|
|
|
915
|
|
|
/** |
916
|
|
|
* @param AMQPReader $args |
917
|
|
|
* @return array |
918
|
|
|
*/ |
919
|
|
|
public static function streamQosOk($args) |
|
|
|
|
920
|
|
|
{ |
921
|
|
|
$ret = array(); |
922
|
|
|
return $ret; |
923
|
|
|
} |
924
|
|
|
|
925
|
|
|
|
926
|
|
|
|
927
|
|
|
/** |
928
|
|
|
* @return array |
929
|
|
|
*/ |
930
|
|
View Code Duplication |
public function streamConsume($ticket = 1, $queue = '', $consumer_tag = '', $no_local = false, $exclusive = false, $nowait = false) |
|
|
|
|
931
|
|
|
{ |
932
|
|
|
$args = new AMQPWriter(); |
933
|
|
|
$args->write_short($ticket); |
934
|
|
|
$args->write_shortstr($queue); |
935
|
|
|
$args->write_shortstr($consumer_tag); |
936
|
|
|
$args->write_bits(array($no_local, $exclusive, $nowait)); |
937
|
|
|
return array(80, 20, $args); |
938
|
|
|
} |
939
|
|
|
|
940
|
|
|
|
941
|
|
|
|
942
|
|
|
/** |
943
|
|
|
* @param AMQPReader $args |
944
|
|
|
* @return array |
945
|
|
|
*/ |
946
|
|
|
public static function streamConsumeOk($args) |
947
|
|
|
{ |
948
|
|
|
$ret = array(); |
949
|
|
|
$ret[] = $args->read_shortstr(); |
950
|
|
|
return $ret; |
951
|
|
|
} |
952
|
|
|
|
953
|
|
|
|
954
|
|
|
|
955
|
|
|
/** |
956
|
|
|
* @return array |
957
|
|
|
*/ |
958
|
|
View Code Duplication |
public function streamCancel($consumer_tag, $nowait = false) |
|
|
|
|
959
|
|
|
{ |
960
|
|
|
$args = new AMQPWriter(); |
961
|
|
|
$args->write_shortstr($consumer_tag); |
962
|
|
|
$args->write_bits(array($nowait)); |
963
|
|
|
return array(80, 30, $args); |
964
|
|
|
} |
965
|
|
|
|
966
|
|
|
|
967
|
|
|
|
968
|
|
|
/** |
969
|
|
|
* @param AMQPReader $args |
970
|
|
|
* @return array |
971
|
|
|
*/ |
972
|
|
|
public static function streamCancelOk($args) |
973
|
|
|
{ |
974
|
|
|
$ret = array(); |
975
|
|
|
$ret[] = $args->read_shortstr(); |
976
|
|
|
return $ret; |
977
|
|
|
} |
978
|
|
|
|
979
|
|
|
|
980
|
|
|
|
981
|
|
|
/** |
982
|
|
|
* @return array |
983
|
|
|
*/ |
984
|
|
View Code Duplication |
public function streamPublish($ticket = 1, $exchange = '', $routing_key = '', $mandatory = false, $immediate = false) |
|
|
|
|
985
|
|
|
{ |
986
|
|
|
$args = new AMQPWriter(); |
987
|
|
|
$args->write_short($ticket); |
988
|
|
|
$args->write_shortstr($exchange); |
989
|
|
|
$args->write_shortstr($routing_key); |
990
|
|
|
$args->write_bits(array($mandatory, $immediate)); |
991
|
|
|
return array(80, 40, $args); |
992
|
|
|
} |
993
|
|
|
|
994
|
|
|
|
995
|
|
|
|
996
|
|
|
/** |
997
|
|
|
* @return array |
998
|
|
|
*/ |
999
|
|
View Code Duplication |
public function streamReturn($reply_code = 200, $reply_text = '', $exchange, $routing_key) |
|
|
|
|
1000
|
|
|
{ |
1001
|
|
|
$args = new AMQPWriter(); |
1002
|
|
|
$args->write_short($reply_code); |
1003
|
|
|
$args->write_shortstr($reply_text); |
1004
|
|
|
$args->write_shortstr($exchange); |
1005
|
|
|
$args->write_shortstr($routing_key); |
1006
|
|
|
return array(80, 50, $args); |
1007
|
|
|
} |
1008
|
|
|
|
1009
|
|
|
|
1010
|
|
|
|
1011
|
|
|
/** |
1012
|
|
|
* @return array |
1013
|
|
|
*/ |
1014
|
|
|
public function streamDeliver($consumer_tag, $delivery_tag, $exchange, $queue) |
1015
|
|
|
{ |
1016
|
|
|
$args = new AMQPWriter(); |
1017
|
|
|
$args->write_shortstr($consumer_tag); |
1018
|
|
|
$args->write_longlong($delivery_tag); |
1019
|
|
|
$args->write_shortstr($exchange); |
1020
|
|
|
$args->write_shortstr($queue); |
1021
|
|
|
return array(80, 60, $args); |
1022
|
|
|
} |
1023
|
|
|
|
1024
|
|
|
|
1025
|
|
|
|
1026
|
|
|
/** |
1027
|
|
|
* @return array |
1028
|
|
|
*/ |
1029
|
|
|
public function txSelect() |
1030
|
|
|
{ |
1031
|
|
|
$args = new AMQPWriter(); |
1032
|
|
|
return array(90, 10, $args); |
1033
|
|
|
} |
1034
|
|
|
|
1035
|
|
|
|
1036
|
|
|
|
1037
|
|
|
/** |
1038
|
|
|
* @param AMQPReader $args |
1039
|
|
|
* @return array |
1040
|
|
|
*/ |
1041
|
|
|
public static function txSelectOk($args) |
|
|
|
|
1042
|
|
|
{ |
1043
|
|
|
$ret = array(); |
1044
|
|
|
return $ret; |
1045
|
|
|
} |
1046
|
|
|
|
1047
|
|
|
|
1048
|
|
|
|
1049
|
|
|
/** |
1050
|
|
|
* @return array |
1051
|
|
|
*/ |
1052
|
|
|
public function txCommit() |
1053
|
|
|
{ |
1054
|
|
|
$args = new AMQPWriter(); |
1055
|
|
|
return array(90, 20, $args); |
1056
|
|
|
} |
1057
|
|
|
|
1058
|
|
|
|
1059
|
|
|
|
1060
|
|
|
/** |
1061
|
|
|
* @param AMQPReader $args |
1062
|
|
|
* @return array |
1063
|
|
|
*/ |
1064
|
|
|
public static function txCommitOk($args) |
|
|
|
|
1065
|
|
|
{ |
1066
|
|
|
$ret = array(); |
1067
|
|
|
return $ret; |
1068
|
|
|
} |
1069
|
|
|
|
1070
|
|
|
|
1071
|
|
|
|
1072
|
|
|
/** |
1073
|
|
|
* @return array |
1074
|
|
|
*/ |
1075
|
|
|
public function txRollback() |
1076
|
|
|
{ |
1077
|
|
|
$args = new AMQPWriter(); |
1078
|
|
|
return array(90, 30, $args); |
1079
|
|
|
} |
1080
|
|
|
|
1081
|
|
|
|
1082
|
|
|
|
1083
|
|
|
/** |
1084
|
|
|
* @param AMQPReader $args |
1085
|
|
|
* @return array |
1086
|
|
|
*/ |
1087
|
|
|
public static function txRollbackOk($args) |
|
|
|
|
1088
|
|
|
{ |
1089
|
|
|
$ret = array(); |
1090
|
|
|
return $ret; |
1091
|
|
|
} |
1092
|
|
|
|
1093
|
|
|
|
1094
|
|
|
|
1095
|
|
|
/** |
1096
|
|
|
* @return array |
1097
|
|
|
*/ |
1098
|
|
|
public function dtxSelect() |
1099
|
|
|
{ |
1100
|
|
|
$args = new AMQPWriter(); |
1101
|
|
|
return array(100, 10, $args); |
1102
|
|
|
} |
1103
|
|
|
|
1104
|
|
|
|
1105
|
|
|
|
1106
|
|
|
/** |
1107
|
|
|
* @param AMQPReader $args |
1108
|
|
|
* @return array |
1109
|
|
|
*/ |
1110
|
|
|
public static function dtxSelectOk($args) |
|
|
|
|
1111
|
|
|
{ |
1112
|
|
|
$ret = array(); |
1113
|
|
|
return $ret; |
1114
|
|
|
} |
1115
|
|
|
|
1116
|
|
|
|
1117
|
|
|
|
1118
|
|
|
/** |
1119
|
|
|
* @return array |
1120
|
|
|
*/ |
1121
|
|
|
public function dtxStart($dtx_identifier) |
1122
|
|
|
{ |
1123
|
|
|
$args = new AMQPWriter(); |
1124
|
|
|
$args->write_shortstr($dtx_identifier); |
1125
|
|
|
return array(100, 20, $args); |
1126
|
|
|
} |
1127
|
|
|
|
1128
|
|
|
|
1129
|
|
|
|
1130
|
|
|
/** |
1131
|
|
|
* @param AMQPReader $args |
1132
|
|
|
* @return array |
1133
|
|
|
*/ |
1134
|
|
|
public static function dtxStartOk($args) |
|
|
|
|
1135
|
|
|
{ |
1136
|
|
|
$ret = array(); |
1137
|
|
|
return $ret; |
1138
|
|
|
} |
1139
|
|
|
|
1140
|
|
|
|
1141
|
|
|
|
1142
|
|
|
/** |
1143
|
|
|
* @return array |
1144
|
|
|
*/ |
1145
|
|
|
public function tunnelRequest($meta_data) |
1146
|
|
|
{ |
1147
|
|
|
$args = new AMQPWriter(); |
1148
|
|
|
$args->write_table(empty($meta_data) ? array() : $meta_data); |
1149
|
|
|
return array(110, 10, $args); |
1150
|
|
|
} |
1151
|
|
|
|
1152
|
|
|
|
1153
|
|
|
|
1154
|
|
|
/** |
1155
|
|
|
* @return array |
1156
|
|
|
*/ |
1157
|
|
|
public function testInteger($integer_1, $integer_2, $integer_3, $integer_4, $operation) |
1158
|
|
|
{ |
1159
|
|
|
$args = new AMQPWriter(); |
1160
|
|
|
$args->write_octet($integer_1); |
1161
|
|
|
$args->write_short($integer_2); |
1162
|
|
|
$args->write_long($integer_3); |
1163
|
|
|
$args->write_longlong($integer_4); |
1164
|
|
|
$args->write_octet($operation); |
1165
|
|
|
return array(120, 10, $args); |
1166
|
|
|
} |
1167
|
|
|
|
1168
|
|
|
|
1169
|
|
|
|
1170
|
|
|
/** |
1171
|
|
|
* @param AMQPReader $args |
1172
|
|
|
* @return array |
1173
|
|
|
*/ |
1174
|
|
|
public static function testIntegerOk($args) |
1175
|
|
|
{ |
1176
|
|
|
$ret = array(); |
1177
|
|
|
$ret[] = $args->read_longlong(); |
1178
|
|
|
return $ret; |
1179
|
|
|
} |
1180
|
|
|
|
1181
|
|
|
|
1182
|
|
|
|
1183
|
|
|
/** |
1184
|
|
|
* @return array |
1185
|
|
|
*/ |
1186
|
|
|
public function testString($string_1, $string_2, $operation) |
1187
|
|
|
{ |
1188
|
|
|
$args = new AMQPWriter(); |
1189
|
|
|
$args->write_shortstr($string_1); |
1190
|
|
|
$args->write_longstr($string_2); |
1191
|
|
|
$args->write_octet($operation); |
1192
|
|
|
return array(120, 20, $args); |
1193
|
|
|
} |
1194
|
|
|
|
1195
|
|
|
|
1196
|
|
|
|
1197
|
|
|
/** |
1198
|
|
|
* @param AMQPReader $args |
1199
|
|
|
* @return array |
1200
|
|
|
*/ |
1201
|
|
|
public static function testStringOk($args) |
1202
|
|
|
{ |
1203
|
|
|
$ret = array(); |
1204
|
|
|
$ret[] = $args->read_longstr(); |
1205
|
|
|
return $ret; |
1206
|
|
|
} |
1207
|
|
|
|
1208
|
|
|
|
1209
|
|
|
|
1210
|
|
|
/** |
1211
|
|
|
* @return array |
1212
|
|
|
*/ |
1213
|
|
|
public function testTable($table, $integer_op, $string_op) |
1214
|
|
|
{ |
1215
|
|
|
$args = new AMQPWriter(); |
1216
|
|
|
$args->write_table(empty($table) ? array() : $table); |
1217
|
|
|
$args->write_octet($integer_op); |
1218
|
|
|
$args->write_octet($string_op); |
1219
|
|
|
return array(120, 30, $args); |
1220
|
|
|
} |
1221
|
|
|
|
1222
|
|
|
|
1223
|
|
|
|
1224
|
|
|
/** |
1225
|
|
|
* @param AMQPReader $args |
1226
|
|
|
* @return array |
1227
|
|
|
*/ |
1228
|
|
|
public static function testTableOk($args) |
1229
|
|
|
{ |
1230
|
|
|
$ret = array(); |
1231
|
|
|
$ret[] = $args->read_longlong(); |
1232
|
|
|
$ret[] = $args->read_longstr(); |
1233
|
|
|
return $ret; |
1234
|
|
|
} |
1235
|
|
|
|
1236
|
|
|
|
1237
|
|
|
|
1238
|
|
|
/** |
1239
|
|
|
* @return array |
1240
|
|
|
*/ |
1241
|
|
|
public function testContent() |
1242
|
|
|
{ |
1243
|
|
|
$args = new AMQPWriter(); |
1244
|
|
|
return array(120, 40, $args); |
1245
|
|
|
} |
1246
|
|
|
|
1247
|
|
|
|
1248
|
|
|
|
1249
|
|
|
/** |
1250
|
|
|
* @param AMQPReader $args |
1251
|
|
|
* @return array |
1252
|
|
|
*/ |
1253
|
|
|
public static function testContentOk($args) |
1254
|
|
|
{ |
1255
|
|
|
$ret = array(); |
1256
|
|
|
$ret[] = $args->read_long(); |
1257
|
|
|
return $ret; |
1258
|
|
|
} |
1259
|
|
|
|
1260
|
|
|
} |
1261
|
|
|
|
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.