@@ -80,8 +80,7 @@ discard block |
||
80 | 80 | $this->getFrameHandler()->writeClose($code, $reason); |
81 | 81 | $this->shutdown(self::CH_WRITE); |
82 | 82 | } |
83 | - } |
|
84 | - finally { |
|
83 | + } finally { |
|
85 | 84 | $this->state = self::STATE_CLOSE; |
86 | 85 | $this->server->remove($this); |
87 | 86 | return parent::close(); |
@@ -173,12 +172,10 @@ discard block |
||
173 | 172 | case self::STATE_CLOSE: |
174 | 173 | return; |
175 | 174 | } |
176 | - } |
|
177 | - catch (WebSocketError $e) { |
|
175 | + } catch (WebSocketError $e) { |
|
178 | 176 | $this->close($e->getCode(), $e->getMessage()); |
179 | 177 | throw $e; |
180 | - } |
|
181 | - catch (Exception $e) { |
|
178 | + } catch (Exception $e) { |
|
182 | 179 | $this->close(Frame::CLOSE_INTERNAL_ERROR); |
183 | 180 | throw $e; |
184 | 181 | } |
@@ -114,12 +114,10 @@ discard block |
||
114 | 114 | try { |
115 | 115 | if ($this->continue === Frame::OP_TEXT) { |
116 | 116 | $this->onText($fragment); |
117 | - } |
|
118 | - else { |
|
117 | + } else { |
|
119 | 118 | $this->onBinary($fragment); |
120 | 119 | } |
121 | - } |
|
122 | - finally { |
|
120 | + } finally { |
|
123 | 121 | if ($fragment->isFinal()) { |
124 | 122 | $this->continue = null; |
125 | 123 | } |
@@ -138,11 +136,9 @@ discard block |
||
138 | 136 | protected function onControl (Frame $control): void { |
139 | 137 | if ($control->isClose()) { |
140 | 138 | $this->onClose($control); |
141 | - } |
|
142 | - elseif ($control->isPing()) { |
|
139 | + } elseif ($control->isPing()) { |
|
143 | 140 | $this->onPing($control); |
144 | - } |
|
145 | - elseif ($control->isPong()) { |
|
141 | + } elseif ($control->isPong()) { |
|
146 | 142 | $this->onPong($control); |
147 | 143 | } |
148 | 144 | } |
@@ -156,8 +152,7 @@ discard block |
||
156 | 152 | $this->onData_SetContinue($data); |
157 | 153 | if ($data->isText()) { |
158 | 154 | $this->onText($data); |
159 | - } |
|
160 | - elseif ($data->isBinary()) { |
|
155 | + } elseif ($data->isBinary()) { |
|
161 | 156 | $this->onBinary($data); |
162 | 157 | } |
163 | 158 | } |
@@ -192,11 +187,9 @@ discard block |
||
192 | 187 | $this->onFrame_CheckLength($frame); |
193 | 188 | if ($frame->isControl()) { |
194 | 189 | $this->onControl($frame); |
195 | - } |
|
196 | - elseif ($frame->isContinue()) { |
|
190 | + } elseif ($frame->isContinue()) { |
|
197 | 191 | $this->onContinue($frame); |
198 | - } |
|
199 | - else { |
|
192 | + } else { |
|
200 | 193 | $this->onData($frame); |
201 | 194 | } |
202 | 195 | } |
@@ -339,12 +332,10 @@ discard block |
||
339 | 332 | if ($length > 65535) { |
340 | 333 | $head .= chr(127); |
341 | 334 | $head .= pack('J', $length); |
342 | - } |
|
343 | - elseif ($length >= 126) { |
|
335 | + } elseif ($length >= 126) { |
|
344 | 336 | $head .= chr(126); |
345 | 337 | $head .= pack('n', $length); |
346 | - } |
|
347 | - else { |
|
338 | + } else { |
|
348 | 339 | $head .= chr($length); |
349 | 340 | } |
350 | 341 | $this->client->write($head . $payload); |