Completed
Push — master ( 9fb81f...0a022c )
by y
01:28
created
src/WebSocket/WebSocketClient.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -88,8 +88,7 @@  discard block
 block discarded – undo
88 88
             if ($code >= 1000 and $this->isOk()) {
89 89
                 $this->frameHandler->writeClose($code, $reason);
90 90
             }
91
-        }
92
-        finally {
91
+        } finally {
93 92
             $this->server->remove($this);
94 93
             parent::close();
95 94
             $this->state = self::STATE_CLOSED;
@@ -216,12 +215,10 @@  discard block
 block discarded – undo
216 215
                 case self::STATE_CLOSED:
217 216
                     return;
218 217
             }
219
-        }
220
-        catch (WebSocketError $e) {
218
+        } catch (WebSocketError $e) {
221 219
             $this->close($e->getCode(), $e->getMessage());
222 220
             throw $e;
223
-        }
224
-        catch (Throwable $e) {
221
+        } catch (Throwable $e) {
225 222
             $this->close(Frame::CLOSE_INTERNAL_ERROR);
226 223
             throw $e;
227 224
         }
Please login to merge, or discard this patch.
src/WebSocket/FrameHandler.php 1 patch
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -117,12 +117,10 @@  discard block
 block discarded – undo
117 117
         try {
118 118
             if ($this->continue === Frame::OP_TEXT) {
119 119
                 $this->onText($frame);
120
-            }
121
-            else {
120
+            } else {
122 121
                 $this->onBinary($frame);
123 122
             }
124
-        }
125
-        finally {
123
+        } finally {
126 124
             if ($frame->isFinal()) {
127 125
                 $this->continue = null;
128 126
             }
@@ -141,14 +139,11 @@  discard block
 block discarded – undo
141 139
     protected function onControl (Frame $frame): void {
142 140
         if ($frame->isClose()) {
143 141
             $this->onClose($frame);
144
-        }
145
-        elseif ($frame->isPing()) {
142
+        } elseif ($frame->isPing()) {
146 143
             $this->onPing($frame);
147
-        }
148
-        elseif ($frame->isPong()) {
144
+        } elseif ($frame->isPong()) {
149 145
             $this->onPong($frame);
150
-        }
151
-        else {
146
+        } else {
152 147
             throw new WebSocketError(Frame::CLOSE_PROTOCOL_ERROR, "Unsupported control frame.", $frame);
153 148
         }
154 149
     }
@@ -162,8 +157,7 @@  discard block
 block discarded – undo
162 157
         $this->onData_SetContinue($frame);
163 158
         if ($frame->isText()) {
164 159
             $this->onText($frame);
165
-        }
166
-        elseif ($frame->isBinary()) {
160
+        } elseif ($frame->isBinary()) {
167 161
             $this->onBinary($frame);
168 162
         }
169 163
     }
@@ -201,11 +195,9 @@  discard block
 block discarded – undo
201 195
         $this->onFrame_CheckLength($frame);
202 196
         if ($frame->isControl()) {
203 197
             $this->onControl($frame);
204
-        }
205
-        elseif ($frame->isContinue()) {
198
+        } elseif ($frame->isContinue()) {
206 199
             $this->onContinue($frame);
207
-        }
208
-        else {
200
+        } else {
209 201
             $this->onData($frame);
210 202
         }
211 203
     }
@@ -351,12 +343,10 @@  discard block
 block discarded – undo
351 343
         if ($length > 65535) {
352 344
             $head .= chr(127);
353 345
             $head .= pack('J', $length);
354
-        }
355
-        elseif ($length >= 126) {
346
+        } elseif ($length >= 126) {
356 347
             $head .= chr(126);
357 348
             $head .= pack('n', $length);
358
-        }
359
-        else {
349
+        } else {
360 350
             $head .= chr($length);
361 351
         }
362 352
         $this->client->write($head . $payload);
Please login to merge, or discard this patch.
src/WebSocket/WebSocketServer.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,8 +101,7 @@
 block discarded – undo
101 101
         foreach ($this->clients as $client) {
102 102
             try {
103 103
                 $client->close($code, $reason); // clients remove themselves
104
-            }
105
-            catch (Exception $e) {
104
+            } catch (Exception $e) {
106 105
                 continue;
107 106
             }
108 107
         }
Please login to merge, or discard this patch.