1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AMQPAL\Adapter\AMQP\Options; |
4
|
|
|
|
5
|
|
|
use AMQPAL\AbstractOptions; |
6
|
|
|
|
7
|
|
|
class ConnectionOptions extends AbstractOptions |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* @var string |
11
|
|
|
*/ |
12
|
|
|
protected $host = 'localhost'; |
13
|
|
|
/** |
14
|
|
|
* @var string |
15
|
|
|
*/ |
16
|
|
|
protected $port = 5672; |
17
|
|
|
/** |
18
|
|
|
* @var string |
19
|
|
|
*/ |
20
|
|
|
protected $username; |
21
|
|
|
/** |
22
|
|
|
* @var string |
23
|
|
|
*/ |
24
|
|
|
protected $password; |
25
|
|
|
/** |
26
|
|
|
* @var string |
27
|
|
|
*/ |
28
|
|
|
protected $vhost = '/'; |
29
|
|
|
/** |
30
|
|
|
* @var int |
31
|
|
|
*/ |
32
|
|
|
protected $readTimeout = 0; |
33
|
|
|
/** |
34
|
|
|
* @var int |
35
|
|
|
*/ |
36
|
|
|
protected $writeTimeout = 0; |
37
|
|
|
/** |
38
|
|
|
* @var int |
39
|
|
|
*/ |
40
|
|
|
protected $connectTimeout = 3; |
41
|
|
|
/** |
42
|
|
|
* @var int |
43
|
|
|
*/ |
44
|
|
|
protected $channelMax; |
45
|
|
|
/** |
46
|
|
|
* @var int |
47
|
|
|
*/ |
48
|
|
|
protected $frameMax; |
49
|
|
|
/** |
50
|
|
|
* @var int |
51
|
|
|
*/ |
52
|
|
|
protected $heartbeat = 0; |
53
|
|
|
/** |
54
|
|
|
* @var bool |
55
|
|
|
*/ |
56
|
|
|
protected $persistent = false; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @return string |
60
|
|
|
*/ |
61
|
9 |
|
public function getHost() |
62
|
|
|
{ |
63
|
9 |
|
return $this->host; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @param string $host |
68
|
|
|
* @return $this |
69
|
|
|
*/ |
70
|
9 |
|
public function setHost($host) |
71
|
|
|
{ |
72
|
9 |
|
$this->host = $host; |
73
|
9 |
|
return $this; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return string |
78
|
|
|
*/ |
79
|
8 |
|
public function getPort() |
80
|
|
|
{ |
81
|
8 |
|
return $this->port; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @param string $port |
86
|
|
|
* @return $this |
87
|
|
|
*/ |
88
|
8 |
|
public function setPort($port) |
89
|
|
|
{ |
90
|
8 |
|
$this->port = $port; |
91
|
8 |
|
return $this; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @return string |
96
|
|
|
*/ |
97
|
8 |
|
public function getUsername() |
98
|
|
|
{ |
99
|
8 |
|
return $this->username; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @param string $username |
104
|
|
|
* @return $this |
105
|
|
|
*/ |
106
|
8 |
|
public function setUsername($username) |
107
|
|
|
{ |
108
|
8 |
|
$this->username = $username; |
109
|
8 |
|
return $this; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @return string |
114
|
|
|
*/ |
115
|
8 |
|
public function getPassword() |
116
|
|
|
{ |
117
|
8 |
|
return $this->password; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @param string $password |
122
|
|
|
* @return $this |
123
|
|
|
*/ |
124
|
8 |
|
public function setPassword($password) |
125
|
|
|
{ |
126
|
8 |
|
$this->password = $password; |
127
|
8 |
|
return $this; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @return string |
132
|
|
|
*/ |
133
|
8 |
|
public function getVhost() |
134
|
|
|
{ |
135
|
8 |
|
return $this->vhost; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @param string $vhost |
140
|
|
|
* @return $this |
141
|
|
|
*/ |
142
|
8 |
|
public function setVhost($vhost) |
143
|
|
|
{ |
144
|
8 |
|
$this->vhost = $vhost; |
145
|
8 |
|
return $this; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* @return int |
150
|
|
|
*/ |
151
|
8 |
|
public function getReadTimeout() |
152
|
|
|
{ |
153
|
8 |
|
return $this->readTimeout; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @param int $readTimeout |
158
|
|
|
* @return $this |
159
|
|
|
*/ |
160
|
1 |
|
public function setReadTimeout($readTimeout) |
161
|
|
|
{ |
162
|
1 |
|
$this->readTimeout = $readTimeout; |
163
|
1 |
|
return $this; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* @return int |
168
|
|
|
*/ |
169
|
8 |
|
public function getWriteTimeout() |
170
|
|
|
{ |
171
|
8 |
|
return $this->writeTimeout; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* @param int $writeTimeout |
176
|
|
|
* @return $this |
177
|
|
|
*/ |
178
|
1 |
|
public function setWriteTimeout($writeTimeout) |
179
|
|
|
{ |
180
|
1 |
|
$this->writeTimeout = $writeTimeout; |
181
|
1 |
|
return $this; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* @return int |
186
|
|
|
*/ |
187
|
8 |
|
public function getConnectTimeout() |
188
|
|
|
{ |
189
|
8 |
|
return $this->connectTimeout; |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* @param int $connectTimeout |
194
|
|
|
* @return $this |
195
|
|
|
*/ |
196
|
1 |
|
public function setConnectTimeout($connectTimeout) |
197
|
|
|
{ |
198
|
1 |
|
$this->connectTimeout = $connectTimeout; |
199
|
1 |
|
return $this; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* @return int |
204
|
|
|
*/ |
205
|
8 |
|
public function getChannelMax() |
206
|
|
|
{ |
207
|
8 |
|
return $this->channelMax; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
/** |
211
|
|
|
* @param int $channelMax |
212
|
|
|
* @return $this |
213
|
|
|
*/ |
214
|
1 |
|
public function setChannelMax($channelMax) |
215
|
|
|
{ |
216
|
1 |
|
$this->channelMax = $channelMax; |
217
|
1 |
|
return $this; |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* @return int |
222
|
|
|
*/ |
223
|
8 |
|
public function getFrameMax() |
224
|
|
|
{ |
225
|
8 |
|
return $this->frameMax; |
226
|
|
|
} |
227
|
|
|
|
228
|
|
|
/** |
229
|
|
|
* @param int $frameMax |
230
|
|
|
* @return $this |
231
|
|
|
*/ |
232
|
1 |
|
public function setFrameMax($frameMax) |
233
|
|
|
{ |
234
|
1 |
|
$this->frameMax = $frameMax; |
235
|
1 |
|
return $this; |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
/** |
239
|
|
|
* @return int |
240
|
|
|
*/ |
241
|
8 |
|
public function getHeartbeat() |
242
|
|
|
{ |
243
|
8 |
|
return $this->heartbeat; |
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
/** |
247
|
|
|
* @param int $heartbeat |
248
|
|
|
* @return $this |
249
|
|
|
*/ |
250
|
1 |
|
public function setHeartbeat($heartbeat) |
251
|
|
|
{ |
252
|
1 |
|
$this->heartbeat = $heartbeat; |
253
|
1 |
|
return $this; |
254
|
|
|
} |
255
|
|
|
|
256
|
|
|
/** |
257
|
|
|
* @return boolean |
258
|
|
|
*/ |
259
|
8 |
|
public function isPersistent() |
260
|
|
|
{ |
261
|
8 |
|
return $this->persistent; |
262
|
|
|
} |
263
|
|
|
|
264
|
|
|
/** |
265
|
|
|
* @param boolean $persistent |
266
|
|
|
* @return $this |
267
|
|
|
*/ |
268
|
1 |
|
public function setPersistent($persistent) |
269
|
|
|
{ |
270
|
1 |
|
$this->persistent = (bool)$persistent; |
271
|
1 |
|
return $this; |
272
|
|
|
} |
273
|
|
|
} |
274
|
|
|
|