@@ -52,8 +52,7 @@ discard block |
||
52 | 52 | $length -= $chunkSize = strlen($chunk); |
53 | 53 | } while ($chunkSize and $length); |
54 | 54 | return $data; |
55 | - } |
|
56 | - catch (SocketError $e) { |
|
55 | + } catch (SocketError $e) { |
|
57 | 56 | $e->setExtra($data); |
58 | 57 | throw $e; |
59 | 58 | } |
@@ -90,8 +89,7 @@ discard block |
||
90 | 89 | $length = $this->getOption(SO_RCVBUF); |
91 | 90 | try { |
92 | 91 | return $this->recv($length, $flags); |
93 | - } |
|
94 | - catch (SocketError $e) { |
|
92 | + } catch (SocketError $e) { |
|
95 | 93 | if ($e->getCode() === SOCKET_EAGAIN) { // would block |
96 | 94 | return ''; |
97 | 95 | } |
@@ -118,8 +118,7 @@ discard block |
||
118 | 118 | $frame |
119 | 119 | ); |
120 | 120 | } |
121 | - } |
|
122 | - finally { |
|
121 | + } finally { |
|
123 | 122 | if ($frame->isFinal()) { |
124 | 123 | $this->continue = null; |
125 | 124 | } |
@@ -138,11 +137,9 @@ discard block |
||
138 | 137 | protected function onControl (Frame $control): void { |
139 | 138 | if ($control->isClose()) { |
140 | 139 | $this->onClose($control); |
141 | - } |
|
142 | - elseif ($control->isPing()) { |
|
140 | + } elseif ($control->isPing()) { |
|
143 | 141 | $this->onPing($control); |
144 | - } |
|
145 | - elseif ($control->isPong()) { |
|
142 | + } elseif ($control->isPong()) { |
|
146 | 143 | $this->onPong($control); |
147 | 144 | } |
148 | 145 | } |
@@ -156,8 +153,7 @@ discard block |
||
156 | 153 | $this->onData_SetContinue($data); |
157 | 154 | if ($data->isText()) { |
158 | 155 | $this->onText($data); |
159 | - } |
|
160 | - elseif ($data->isBinary()) { |
|
156 | + } elseif ($data->isBinary()) { |
|
161 | 157 | $this->onBinary($data); |
162 | 158 | } |
163 | 159 | } |
@@ -188,11 +184,9 @@ discard block |
||
188 | 184 | $this->onFrame_CheckLength($frame); |
189 | 185 | if ($frame->isControl()) { |
190 | 186 | $this->onControl($frame); |
191 | - } |
|
192 | - elseif ($frame->isContinue()) { |
|
187 | + } elseif ($frame->isContinue()) { |
|
193 | 188 | $this->onContinue($frame); |
194 | - } |
|
195 | - else { |
|
189 | + } else { |
|
196 | 190 | $this->onData($frame); |
197 | 191 | } |
198 | 192 | } |
@@ -336,12 +330,10 @@ discard block |
||
336 | 330 | if ($length > 65535) { |
337 | 331 | $head .= chr(127); |
338 | 332 | $head .= pack('J', $length); |
339 | - } |
|
340 | - elseif ($length >= 126) { |
|
333 | + } elseif ($length >= 126) { |
|
341 | 334 | $head .= chr(126); |
342 | 335 | $head .= pack('n', $length); |
343 | - } |
|
344 | - else { |
|
336 | + } else { |
|
345 | 337 | $head .= chr($length); |
346 | 338 | } |
347 | 339 | $this->client->write($head . $payload); |