Completed
Push — master ( 1f28ab...083bb9 )
by y
01:17
created
src/WebSocket/FrameHandler.php 1 patch
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -105,8 +105,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.