@@ -105,8 +105,7 @@ discard block |
||
105 | 105 | protected function onBinary (Frame $frame): void { |
106 | 106 | if ($this->stream) { |
107 | 107 | $this->client->onBinary($frame->getPayload()); |
108 | - } |
|
109 | - else { |
|
108 | + } else { |
|
110 | 109 | $this->onData_CheckLength($frame); |
111 | 110 | $this->buffer .= $frame->getPayload(); |
112 | 111 | if ($frame->isFinal()) { |
@@ -149,12 +148,10 @@ discard block |
||
149 | 148 | try { |
150 | 149 | if ($this->continue === Frame::OP_TEXT) { |
151 | 150 | $this->onText($frame); |
152 | - } |
|
153 | - else { |
|
151 | + } else { |
|
154 | 152 | $this->onBinary($frame); |
155 | 153 | } |
156 | - } |
|
157 | - finally { |
|
154 | + } finally { |
|
158 | 155 | if ($frame->isFinal()) { |
159 | 156 | $this->continue = null; |
160 | 157 | } |
@@ -173,14 +170,11 @@ discard block |
||
173 | 170 | protected function onControl (Frame $frame): void { |
174 | 171 | if ($frame->isClose()) { |
175 | 172 | $this->onClose($frame); |
176 | - } |
|
177 | - elseif ($frame->isPing()) { |
|
173 | + } elseif ($frame->isPing()) { |
|
178 | 174 | $this->onPing($frame); |
179 | - } |
|
180 | - elseif ($frame->isPong()) { |
|
175 | + } elseif ($frame->isPong()) { |
|
181 | 176 | $this->onPong($frame); |
182 | - } |
|
183 | - else { |
|
177 | + } else { |
|
184 | 178 | throw new WebSocketError(Frame::CLOSE_PROTOCOL_ERROR, "Unsupported control frame.", $frame); |
185 | 179 | } |
186 | 180 | } |
@@ -248,8 +242,7 @@ discard block |
||
248 | 242 | public function onFrame (Frame $frame): void { |
249 | 243 | if ($frame->isControl()) { |
250 | 244 | $this->onControl($frame); |
251 | - } |
|
252 | - else { |
|
245 | + } else { |
|
253 | 246 | $this->onData($frame); |
254 | 247 | } |
255 | 248 | } |
@@ -378,12 +371,10 @@ discard block |
||
378 | 371 | if ($length > 65535) { |
379 | 372 | $head .= chr(127); |
380 | 373 | $head .= pack('J', $length); |
381 | - } |
|
382 | - elseif ($length >= 126) { |
|
374 | + } elseif ($length >= 126) { |
|
383 | 375 | $head .= chr(126); |
384 | 376 | $head .= pack('n', $length); |
385 | - } |
|
386 | - else { |
|
377 | + } else { |
|
387 | 378 | $head .= chr($length); |
388 | 379 | } |
389 | 380 | $this->client->write($head . $payload); |