1 | <?php |
||
12 | class Pool implements StreamInterface |
||
13 | { |
||
14 | |||
15 | /** |
||
16 | * @var array |
||
17 | */ |
||
18 | protected $nodeUrls; |
||
19 | |||
20 | /** |
||
21 | * @var LoggerInterface |
||
22 | */ |
||
23 | protected $log; |
||
24 | |||
25 | /** |
||
26 | * @var StreamInterface |
||
27 | */ |
||
28 | protected $connected; |
||
29 | |||
30 | |||
31 | /** |
||
32 | * @param array $nodeUrls |
||
33 | * @param LoggerInterface|null $log |
||
34 | * |
||
35 | * @throws ConnectException |
||
36 | */ |
||
37 | 28 | public function __construct(array $nodeUrls = array(), LoggerInterface $log = null) |
|
48 | |||
49 | |||
50 | /** |
||
51 | * @return array |
||
52 | */ |
||
53 | 1 | public function getNodeUrls() |
|
57 | |||
58 | |||
59 | /** |
||
60 | * @return StreamInterface |
||
61 | */ |
||
62 | 1 | public function getActiveNode() |
|
66 | |||
67 | |||
68 | /** |
||
69 | * @return bool |
||
70 | * @throws ConnectException |
||
71 | */ |
||
72 | 1 | public function reconnect() |
|
79 | |||
80 | |||
81 | /** |
||
82 | * Connect to a random node in the node list. |
||
83 | * |
||
84 | * @return DefaultStream Stream to a connected node. |
||
85 | * |
||
86 | * @throws ConnectException |
||
87 | */ |
||
88 | 28 | public function connect() |
|
111 | |||
112 | |||
113 | /** |
||
114 | * Read a line from the stream |
||
115 | * |
||
116 | * @return string |
||
117 | */ |
||
118 | 23 | public function readLine() |
|
122 | |||
123 | |||
124 | /** |
||
125 | * Read bytes off from the stream. |
||
126 | * |
||
127 | * @param int|null $maxlen |
||
128 | * |
||
129 | * @return string The response. |
||
130 | */ |
||
131 | 13 | public function readBytes($maxlen = null) |
|
135 | |||
136 | |||
137 | /** |
||
138 | * @param string $msg |
||
139 | * @param int|null $len |
||
140 | * |
||
141 | * @return StreamInterface the Stream instance. |
||
142 | */ |
||
143 | 23 | public function write($msg, $len = null) |
|
149 | |||
150 | |||
151 | /** |
||
152 | * Close the stream. |
||
153 | * |
||
154 | * @return bool True on success. |
||
155 | */ |
||
156 | 26 | public function close() |
|
160 | |||
161 | |||
162 | /** |
||
163 | * Check if the stream is connected. |
||
164 | * |
||
165 | * @return boolean True if the stream is connected. |
||
166 | */ |
||
167 | 2 | public function isConnected() |
|
171 | |||
172 | |||
173 | /** |
||
174 | * return the internal stream url. |
||
175 | * |
||
176 | * @return string |
||
177 | */ |
||
178 | 2 | public function getNodeUrl() |
|
182 | } |
||
183 |
This check examines a number of code elements and verifies that they conform to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.