1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace RabbitMqModule\Options; |
4
|
|
|
|
5
|
|
|
use Zend\Stdlib\AbstractOptions; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class Connection |
9
|
|
|
* @package RabbitMqModule\Options |
10
|
|
|
*/ |
11
|
|
|
class Connection extends AbstractOptions |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* @var string |
15
|
|
|
*/ |
16
|
|
|
protected $type = 'stream'; |
17
|
|
|
/** |
18
|
|
|
* @var string |
19
|
|
|
*/ |
20
|
|
|
protected $host = 'localhost'; |
21
|
|
|
/** |
22
|
|
|
* @var string |
23
|
|
|
*/ |
24
|
|
|
protected $port = 5672; |
25
|
|
|
/** |
26
|
|
|
* @var string |
27
|
|
|
*/ |
28
|
|
|
protected $username; |
29
|
|
|
/** |
30
|
|
|
* @var string |
31
|
|
|
*/ |
32
|
|
|
protected $password; |
33
|
|
|
/** |
34
|
|
|
* @var string |
35
|
|
|
*/ |
36
|
|
|
protected $vhost = '/'; |
37
|
|
|
/** |
38
|
|
|
* @var bool |
39
|
|
|
*/ |
40
|
|
|
protected $insist = false; |
41
|
|
|
/** |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
protected $loginMethod = 'AMQPLAIN'; |
45
|
|
|
/** |
46
|
|
|
* @var string |
47
|
|
|
*/ |
48
|
|
|
protected $locale = 'en_US'; |
49
|
|
|
/** |
50
|
|
|
* @var int |
51
|
|
|
*/ |
52
|
|
|
protected $readWriteTimeout = 3; |
53
|
|
|
/** |
54
|
|
|
* @var bool |
55
|
|
|
*/ |
56
|
|
|
protected $keepAlive = false; |
57
|
|
|
/** |
58
|
|
|
* @var int |
59
|
|
|
*/ |
60
|
|
|
protected $connectionTimeout = 3; |
61
|
|
|
/** |
62
|
|
|
* @var int |
63
|
|
|
*/ |
64
|
|
|
protected $heartbeat = 0; |
65
|
|
|
/** |
66
|
|
|
* @var array |
67
|
|
|
*/ |
68
|
|
|
protected $sslOptions; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @return string |
72
|
|
|
*/ |
73
|
4 |
|
public function getType() |
74
|
|
|
{ |
75
|
4 |
|
return $this->type; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @param string $type |
80
|
|
|
* |
81
|
|
|
* @return $this |
82
|
|
|
*/ |
83
|
4 |
|
public function setType($type) |
84
|
|
|
{ |
85
|
4 |
|
$this->type = $type; |
86
|
|
|
|
87
|
4 |
|
return $this; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @return string |
92
|
|
|
*/ |
93
|
1 |
|
public function getHost() |
94
|
|
|
{ |
95
|
1 |
|
return $this->host; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @param string $host |
100
|
|
|
* |
101
|
|
|
* @return $this |
102
|
|
|
*/ |
103
|
1 |
|
public function setHost($host) |
104
|
|
|
{ |
105
|
1 |
|
$this->host = $host; |
106
|
|
|
|
107
|
1 |
|
return $this; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @return string |
112
|
|
|
*/ |
113
|
1 |
|
public function getPort() |
114
|
|
|
{ |
115
|
1 |
|
return $this->port; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @param string $port |
120
|
|
|
* |
121
|
|
|
* @return $this |
122
|
|
|
*/ |
123
|
1 |
|
public function setPort($port) |
124
|
|
|
{ |
125
|
1 |
|
$this->port = $port; |
126
|
|
|
|
127
|
1 |
|
return $this; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @return string |
132
|
|
|
*/ |
133
|
1 |
|
public function getUsername() |
134
|
|
|
{ |
135
|
1 |
|
return $this->username; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @param string $username |
140
|
|
|
* |
141
|
|
|
* @return $this |
142
|
|
|
*/ |
143
|
1 |
|
public function setUsername($username) |
144
|
|
|
{ |
145
|
1 |
|
$this->username = $username; |
146
|
|
|
|
147
|
1 |
|
return $this; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* @return string |
152
|
|
|
*/ |
153
|
1 |
|
public function getPassword() |
154
|
|
|
{ |
155
|
1 |
|
return $this->password; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* @param string $password |
160
|
|
|
* |
161
|
|
|
* @return $this |
162
|
|
|
*/ |
163
|
1 |
|
public function setPassword($password) |
164
|
|
|
{ |
165
|
1 |
|
$this->password = $password; |
166
|
|
|
|
167
|
1 |
|
return $this; |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* @return string |
172
|
|
|
*/ |
173
|
1 |
|
public function getVhost() |
174
|
|
|
{ |
175
|
1 |
|
return $this->vhost; |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* @param string $vhost |
180
|
|
|
* |
181
|
|
|
* @return $this |
182
|
|
|
*/ |
183
|
1 |
|
public function setVhost($vhost) |
184
|
|
|
{ |
185
|
1 |
|
$this->vhost = $vhost; |
186
|
|
|
|
187
|
1 |
|
return $this; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* @return bool |
192
|
|
|
*/ |
193
|
1 |
|
public function isInsist() |
194
|
|
|
{ |
195
|
1 |
|
return $this->insist; |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* @param bool $insist |
200
|
|
|
* |
201
|
|
|
* @return $this |
202
|
|
|
*/ |
203
|
1 |
|
public function setInsist($insist) |
204
|
|
|
{ |
205
|
1 |
|
$this->insist = $insist; |
206
|
|
|
|
207
|
1 |
|
return $this; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
/** |
211
|
|
|
* @return string |
212
|
|
|
*/ |
213
|
1 |
|
public function getLoginMethod() |
214
|
|
|
{ |
215
|
1 |
|
return $this->loginMethod; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
/** |
219
|
|
|
* @param string $loginMethod |
220
|
|
|
* |
221
|
|
|
* @return $this |
222
|
|
|
*/ |
223
|
1 |
|
public function setLoginMethod($loginMethod) |
224
|
|
|
{ |
225
|
1 |
|
$this->loginMethod = $loginMethod; |
226
|
|
|
|
227
|
1 |
|
return $this; |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* @return string |
232
|
|
|
*/ |
233
|
1 |
|
public function getLocale() |
234
|
|
|
{ |
235
|
1 |
|
return $this->locale; |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
/** |
239
|
|
|
* @param string $locale |
240
|
|
|
* |
241
|
|
|
* @return $this |
242
|
|
|
*/ |
243
|
1 |
|
public function setLocale($locale) |
244
|
|
|
{ |
245
|
1 |
|
$this->locale = $locale; |
246
|
|
|
|
247
|
1 |
|
return $this; |
248
|
|
|
} |
249
|
|
|
|
250
|
|
|
/** |
251
|
|
|
* @return int |
252
|
|
|
*/ |
253
|
1 |
|
public function getReadWriteTimeout() |
254
|
|
|
{ |
255
|
1 |
|
return $this->readWriteTimeout; |
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
/** |
259
|
|
|
* @param int $readWriteTimeout |
260
|
|
|
* |
261
|
|
|
* @return $this |
262
|
|
|
*/ |
263
|
1 |
|
public function setReadWriteTimeout($readWriteTimeout) |
264
|
|
|
{ |
265
|
1 |
|
$this->readWriteTimeout = $readWriteTimeout; |
266
|
|
|
|
267
|
1 |
|
return $this; |
268
|
|
|
} |
269
|
|
|
|
270
|
|
|
/** |
271
|
|
|
* @return bool |
272
|
|
|
*/ |
273
|
1 |
|
public function isKeepAlive() |
274
|
|
|
{ |
275
|
1 |
|
return $this->keepAlive; |
276
|
|
|
} |
277
|
|
|
|
278
|
|
|
/** |
279
|
|
|
* @param bool $keepAlive |
280
|
|
|
* |
281
|
|
|
* @return $this |
282
|
|
|
*/ |
283
|
1 |
|
public function setKeepAlive($keepAlive) |
284
|
|
|
{ |
285
|
1 |
|
$this->keepAlive = $keepAlive; |
286
|
|
|
|
287
|
1 |
|
return $this; |
288
|
|
|
} |
289
|
|
|
|
290
|
|
|
/** |
291
|
|
|
* @return int |
292
|
|
|
*/ |
293
|
1 |
|
public function getConnectionTimeout() |
294
|
|
|
{ |
295
|
1 |
|
return $this->connectionTimeout; |
296
|
|
|
} |
297
|
|
|
|
298
|
|
|
/** |
299
|
|
|
* @param int $connectionTimeout |
300
|
|
|
* |
301
|
|
|
* @return $this |
302
|
|
|
*/ |
303
|
1 |
|
public function setConnectionTimeout($connectionTimeout) |
304
|
|
|
{ |
305
|
1 |
|
$this->connectionTimeout = $connectionTimeout; |
306
|
|
|
|
307
|
1 |
|
return $this; |
308
|
|
|
} |
309
|
|
|
|
310
|
|
|
/** |
311
|
|
|
* @return int |
312
|
|
|
*/ |
313
|
1 |
|
public function getHeartbeat() |
314
|
|
|
{ |
315
|
1 |
|
return $this->heartbeat; |
316
|
|
|
} |
317
|
|
|
|
318
|
|
|
/** |
319
|
|
|
* @param int $heartbeat |
320
|
|
|
* |
321
|
|
|
* @return $this |
322
|
|
|
*/ |
323
|
1 |
|
public function setHeartbeat($heartbeat) |
324
|
|
|
{ |
325
|
1 |
|
$this->heartbeat = $heartbeat; |
326
|
|
|
|
327
|
1 |
|
return $this; |
328
|
|
|
} |
329
|
|
|
|
330
|
|
|
/** |
331
|
|
|
* @return array |
332
|
|
|
*/ |
333
|
1 |
|
public function getSslOptions() |
334
|
|
|
{ |
335
|
1 |
|
return $this->sslOptions; |
336
|
|
|
} |
337
|
|
|
|
338
|
|
|
/** |
339
|
|
|
* @param array $sslOptions |
340
|
|
|
* |
341
|
|
|
* @return $this |
342
|
|
|
*/ |
343
|
1 |
|
public function setSslOptions(array $sslOptions) |
344
|
|
|
{ |
345
|
1 |
|
$this->sslOptions = $sslOptions; |
346
|
|
|
|
347
|
1 |
|
return $this; |
348
|
|
|
} |
349
|
|
|
} |
350
|
|
|
|