1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* This file is automatically generated. |
4
|
|
|
*/ |
5
|
|
|
|
6
|
|
|
namespace ButterAMQP\Framing\Method; |
7
|
|
|
|
8
|
|
|
use ButterAMQP\Framing\Frame; |
9
|
|
|
use ButterAMQP\Value; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Declare queue, create if needed. |
13
|
|
|
* |
14
|
|
|
* @codeCoverageIgnore |
15
|
|
|
*/ |
16
|
|
|
class QueueDeclare extends Frame |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* @var int |
20
|
|
|
*/ |
21
|
|
|
private $reserved1; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var string |
25
|
|
|
*/ |
26
|
|
|
private $queue; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var bool |
30
|
|
|
*/ |
31
|
|
|
private $passive; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var bool |
35
|
|
|
*/ |
36
|
|
|
private $durable; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var bool |
40
|
|
|
*/ |
41
|
|
|
private $exclusive; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var bool |
45
|
|
|
*/ |
46
|
|
|
private $autoDelete; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var bool |
50
|
|
|
*/ |
51
|
|
|
private $noWait; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @var array |
55
|
|
|
*/ |
56
|
|
|
private $arguments = []; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @param int $channel |
60
|
|
|
* @param int $reserved1 |
61
|
|
|
* @param string $queue |
62
|
|
|
* @param bool $passive |
63
|
|
|
* @param bool $durable |
64
|
|
|
* @param bool $exclusive |
65
|
|
|
* @param bool $autoDelete |
66
|
|
|
* @param bool $noWait |
67
|
|
|
* @param array $arguments |
68
|
|
|
*/ |
69
|
|
|
public function __construct($channel, $reserved1, $queue, $passive, $durable, $exclusive, $autoDelete, $noWait, $arguments) |
70
|
|
|
{ |
71
|
|
|
$this->reserved1 = $reserved1; |
72
|
|
|
$this->queue = $queue; |
73
|
|
|
$this->passive = $passive; |
74
|
|
|
$this->durable = $durable; |
75
|
|
|
$this->exclusive = $exclusive; |
76
|
|
|
$this->autoDelete = $autoDelete; |
77
|
|
|
$this->noWait = $noWait; |
78
|
|
|
$this->arguments = $arguments; |
79
|
|
|
|
80
|
|
|
parent::__construct($channel); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Reserved1. |
85
|
|
|
* |
86
|
|
|
* @return int |
87
|
|
|
*/ |
88
|
|
|
public function getReserved1() |
89
|
|
|
{ |
90
|
|
|
return $this->reserved1; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Queue. |
95
|
|
|
* |
96
|
|
|
* @return string |
97
|
|
|
*/ |
98
|
|
|
public function getQueue() |
99
|
|
|
{ |
100
|
|
|
return $this->queue; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* Do not create queue. |
105
|
|
|
* |
106
|
|
|
* @return bool |
107
|
|
|
*/ |
108
|
|
|
public function isPassive() |
109
|
|
|
{ |
110
|
|
|
return $this->passive; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Request a durable queue. |
115
|
|
|
* |
116
|
|
|
* @return bool |
117
|
|
|
*/ |
118
|
|
|
public function isDurable() |
119
|
|
|
{ |
120
|
|
|
return $this->durable; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* Request an exclusive queue. |
125
|
|
|
* |
126
|
|
|
* @return bool |
127
|
|
|
*/ |
128
|
|
|
public function isExclusive() |
129
|
|
|
{ |
130
|
|
|
return $this->exclusive; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* Auto-delete queue when unused. |
135
|
|
|
* |
136
|
|
|
* @return bool |
137
|
|
|
*/ |
138
|
|
|
public function isAutoDelete() |
139
|
|
|
{ |
140
|
|
|
return $this->autoDelete; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* NoWait. |
145
|
|
|
* |
146
|
|
|
* @return bool |
147
|
|
|
*/ |
148
|
|
|
public function isNoWait() |
149
|
|
|
{ |
150
|
|
|
return $this->noWait; |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* Arguments for declaration. |
155
|
|
|
* |
156
|
|
|
* @return array |
157
|
|
|
*/ |
158
|
|
|
public function getArguments() |
159
|
|
|
{ |
160
|
|
|
return $this->arguments; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @return string |
165
|
|
|
*/ |
166
|
|
|
public function encode() |
167
|
|
|
{ |
168
|
|
|
$data = "\x00\x32\x00\x0A". |
169
|
|
|
Value\ShortValue::encode($this->reserved1). |
170
|
|
|
Value\ShortStringValue::encode($this->queue). |
171
|
|
|
Value\OctetValue::encode(($this->passive ? 1 : 0) | (($this->durable ? 1 : 0) << 1) | (($this->exclusive ? 1 : 0) << 2) | (($this->autoDelete ? 1 : 0) << 3) | (($this->noWait ? 1 : 0) << 4)). |
172
|
|
|
Value\TableValue::encode($this->arguments); |
173
|
|
|
|
174
|
|
|
return "\x01".pack('nN', $this->channel, strlen($data)).$data."\xCE"; |
175
|
|
|
} |
176
|
|
|
} |
177
|
|
|
|