@@ -31,12 +31,10 @@ |
||
31 | 31 | if ($len > 65535) { |
32 | 32 | $frame .= chr(127); |
33 | 33 | $frame .= pack('J', $len); |
34 | - } |
|
35 | - elseif ($len >= 126) { |
|
34 | + } elseif ($len >= 126) { |
|
36 | 35 | $frame .= chr(126); |
37 | 36 | $frame .= pack('n', $len); |
38 | - } |
|
39 | - else { |
|
37 | + } else { |
|
40 | 38 | $frame .= chr($len); |
41 | 39 | } |
42 | 40 | return $frame . $payload; |
@@ -57,14 +57,11 @@ |
||
57 | 57 | $frame = new WebSocketFrame($data); |
58 | 58 | if ($frame->isText()) { |
59 | 59 | $this->onText($frame->getPayload()); |
60 | - } |
|
61 | - elseif ($frame->isBinary()) { |
|
60 | + } elseif ($frame->isBinary()) { |
|
62 | 61 | $this->onData($frame->getPayload()); |
63 | - } |
|
64 | - elseif ($frame->isPong()) { |
|
62 | + } elseif ($frame->isPong()) { |
|
65 | 63 | $this->onPong(); |
66 | - } |
|
67 | - elseif ($frame->isClose()) { |
|
64 | + } elseif ($frame->isClose()) { |
|
68 | 65 | $this->close(); |
69 | 66 | } |
70 | 67 | } |
@@ -19,8 +19,7 @@ discard block |
||
19 | 19 | public function __toString () { |
20 | 20 | try { |
21 | 21 | return implode(':', $this->getPeerName()); |
22 | - } |
|
23 | - catch (Exception $exception) { |
|
22 | + } catch (Exception $exception) { |
|
24 | 23 | return ':'; |
25 | 24 | } |
26 | 25 | } |
@@ -109,8 +108,7 @@ discard block |
||
109 | 108 | try { |
110 | 109 | $total += $count = $this->await(self::CH_WRITE)->send($data); |
111 | 110 | $data = substr($data, $count); // 0 bytes sent = unaltered buffer |
112 | - } |
|
113 | - catch (Error $error) { |
|
111 | + } catch (Error $error) { |
|
114 | 112 | $error->setExtra($total); |
115 | 113 | throw $error; |
116 | 114 | } |