1 | <?php |
||
10 | class Connection extends AbstractOptions |
||
11 | { |
||
12 | const SCHEME_TCP = 'tcp://'; |
||
13 | |||
14 | /** |
||
15 | * Hostname. |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $host; |
||
20 | /** |
||
21 | * Connection scheme. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $scheme = 'tcp://'; |
||
26 | /** |
||
27 | * Connection port. |
||
28 | * |
||
29 | * @var int |
||
30 | */ |
||
31 | protected $port = 5038; |
||
32 | /** |
||
33 | * Username. |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $username; |
||
38 | /** |
||
39 | * Password. |
||
40 | * |
||
41 | * @var string |
||
42 | */ |
||
43 | protected $secret; |
||
44 | /** |
||
45 | * Connection timeout. |
||
46 | * |
||
47 | * @var int |
||
48 | */ |
||
49 | protected $connectTimeout = 10000; |
||
50 | /** |
||
51 | * Read timeout. |
||
52 | * |
||
53 | * @var int |
||
54 | */ |
||
55 | protected $readTimeout = 10000; |
||
56 | |||
57 | /** |
||
58 | * Return the host. |
||
59 | * |
||
60 | * @return string |
||
61 | */ |
||
62 | 3 | public function getHost() |
|
66 | |||
67 | /** |
||
68 | * Set the host. |
||
69 | * |
||
70 | * @param string $host IP address or hostname |
||
71 | * |
||
72 | * @return $this |
||
73 | */ |
||
74 | 3 | public function setHost($host) |
|
80 | |||
81 | /** |
||
82 | * Return the connection scheme. |
||
83 | * |
||
84 | * @return string |
||
85 | */ |
||
86 | 3 | public function getScheme() |
|
90 | |||
91 | /** |
||
92 | * Set the connection scheme. |
||
93 | * |
||
94 | * @param string $scheme Connection scheme |
||
95 | * |
||
96 | * @return $this |
||
97 | */ |
||
98 | 3 | public function setScheme($scheme) |
|
104 | |||
105 | /** |
||
106 | * Return the connection port. |
||
107 | * |
||
108 | * @return int |
||
109 | */ |
||
110 | 3 | public function getPort() |
|
114 | |||
115 | /** |
||
116 | * Set the connection port. |
||
117 | * |
||
118 | * @param int $port Connection port |
||
119 | * |
||
120 | * @return $this |
||
121 | */ |
||
122 | 3 | public function setPort($port) |
|
128 | |||
129 | /** |
||
130 | * Get the username. |
||
131 | * |
||
132 | * @return string |
||
133 | */ |
||
134 | 3 | public function getUsername() |
|
138 | |||
139 | /** |
||
140 | * Set the username. |
||
141 | * |
||
142 | * @param string $username Username |
||
143 | * |
||
144 | * @return $this |
||
145 | */ |
||
146 | 3 | public function setUsername($username) |
|
152 | |||
153 | /** |
||
154 | * Return the password. |
||
155 | * |
||
156 | * @return string |
||
157 | */ |
||
158 | 3 | public function getSecret() |
|
162 | |||
163 | /** |
||
164 | * Set the password. |
||
165 | * |
||
166 | * @param string $secret Password |
||
167 | * |
||
168 | * @return $this |
||
169 | */ |
||
170 | 3 | public function setSecret($secret) |
|
176 | |||
177 | /** |
||
178 | * Get the connection timeout in ms. |
||
179 | * |
||
180 | * @return int |
||
181 | */ |
||
182 | 3 | public function getConnectTimeout() |
|
186 | |||
187 | /** |
||
188 | * Set the connection timeout. |
||
189 | * |
||
190 | * @param int $connectTimeout Connection timeout in ms |
||
191 | * |
||
192 | * @return $this |
||
193 | */ |
||
194 | 3 | public function setConnectTimeout($connectTimeout) |
|
200 | |||
201 | /** |
||
202 | * Return the read timeout in ms. |
||
203 | * |
||
204 | * @return int |
||
205 | */ |
||
206 | 3 | public function getReadTimeout() |
|
210 | |||
211 | /** |
||
212 | * Set the read timeout. |
||
213 | * |
||
214 | * @param int $readTimeout Read timeout in ms |
||
215 | * |
||
216 | * @return $this |
||
217 | */ |
||
218 | 3 | public function setReadTimeout($readTimeout) |
|
224 | } |
||
225 |