Completed
Push — master ( 0879f5...68508b )
by y
01:37
created
src/WebSocket/WebSocketClient.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * @param resource $resource
54 54
      * @param WebSocketServer $server
55 55
      */
56
-    public function __construct ($resource, WebSocketServer $server) {
56
+    public function __construct($resource, WebSocketServer $server) {
57 57
         parent::__construct($resource);
58 58
         $this->server = $server;
59 59
         $this->handshake = new Handshake($this);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      * @param string $reason Sent to the peer, if code is >= 1000
79 79
      * @return $this
80 80
      */
81
-    public function close (int $code = null, string $reason = '') {
81
+    public function close(int $code = null, string $reason = '') {
82 82
         try {
83 83
             if ($code >= 1000 and $this->isOk()) {
84 84
                 $this->frameHandler->writeClose($code, $reason);
@@ -95,32 +95,32 @@  discard block
 block discarded – undo
95 95
     /**
96 96
      * @return FrameHandler
97 97
      */
98
-    public function getFrameHandler (): FrameHandler {
98
+    public function getFrameHandler(): FrameHandler {
99 99
         return $this->frameHandler;
100 100
     }
101 101
 
102 102
     /**
103 103
      * @return WebSocketServer
104 104
      */
105
-    public function getServer (): WebSocketServer {
105
+    public function getServer(): WebSocketServer {
106 106
         return $this->server;
107 107
     }
108 108
 
109 109
     /**
110 110
      * @return int
111 111
      */
112
-    public function getState (): int {
112
+    public function getState(): int {
113 113
         return $this->state;
114 114
     }
115 115
 
116
-    final public function isNegotiating (): bool {
116
+    final public function isNegotiating(): bool {
117 117
         return $this->state === self::STATE_HANDSHAKE;
118 118
     }
119 119
 
120 120
     /**
121 121
      * @return bool
122 122
      */
123
-    final public function isOk (): bool {
123
+    final public function isOk(): bool {
124 124
         return $this->state === self::STATE_OK;
125 125
     }
126 126
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
      * @param string $binary
133 133
      * @throws WebSocketError
134 134
      */
135
-    public function onBinary (string $binary): void {
135
+    public function onBinary(string $binary): void {
136 136
         unset($binary);
137 137
         throw new WebSocketError(Frame::CLOSE_UNHANDLED_DATA, "I don't handle binary data.");
138 138
     }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      * @param int $code
144 144
      * @param string $reason
145 145
      */
146
-    public function onClose (int $code, string $reason): void {
146
+    public function onClose(int $code, string $reason): void {
147 147
         unset($code, $reason);
148 148
         $this->close();
149 149
     }
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
      *
156 156
      * Closes the connection with a protocol-error frame.
157 157
      */
158
-    final public function onOutOfBand (): void {
158
+    final public function onOutOfBand(): void {
159 159
         $this->close(Frame::CLOSE_PROTOCOL_ERROR, "Received out-of-band data.");
160 160
     }
161 161
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      *
167 167
      * @param string $message
168 168
      */
169
-    public function onPing (string $message): void {
169
+    public function onPing(string $message): void {
170 170
         $this->frameHandler->writePong($message);
171 171
     }
172 172
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      *
178 178
      * @param string $message
179 179
      */
180
-    public function onPong (string $message): void {
180
+    public function onPong(string $message): void {
181 181
         // stub
182 182
     }
183 183
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      * @throws WebSocketError
188 188
      * @throws Throwable
189 189
      */
190
-    public function onReadable (): void {
190
+    public function onReadable(): void {
191 191
         try {
192 192
             if ($this->isNegotiating()) {
193 193
                 if ($this->handshake->onReadable()) {
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
      * If you have negotiated an extension during {@link Handshake},
218 218
      * claim the RSV bits here via {@link FrameReader::setRsv()}
219 219
      */
220
-    protected function onStateOk (): void {
220
+    protected function onStateOk(): void {
221 221
         // stub
222 222
     }
223 223
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      * @param string $text
230 230
      * @throws WebSocketError
231 231
      */
232
-    public function onText (string $text): void {
232
+    public function onText(string $text): void {
233 233
         unset($text);
234 234
         throw new WebSocketError(Frame::CLOSE_UNHANDLED_DATA, "I don't handle text.");
235 235
     }
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
      *
240 240
      * @param string $binary
241 241
      */
242
-    public function writeBinary (string $binary): void {
242
+    public function writeBinary(string $binary): void {
243 243
         $this->frameHandler->writeBinary($binary);
244 244
     }
245 245
 
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      * @param mixed $data
250 250
      * @throws JsonException
251 251
      */
252
-    public function writeJSON ($data): void {
252
+    public function writeJSON($data): void {
253 253
         $this->frameHandler->writeText(json_encode($data, JSON_THROW_ON_ERROR));
254 254
     }
255 255
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      *
259 259
      * @param string $text
260 260
      */
261
-    public function writeText (string $text): void {
261
+    public function writeText(string $text): void {
262 262
         $this->frameHandler->writeText($text);
263 263
     }
264 264
 
Please login to merge, or discard this patch.