Completed
Branch master (2d58e0)
by Arthur
01:43
created
src/WebSocketServer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -285,14 +285,14 @@
 block discarded – undo
285 285
     private function handshake($client, $headers)
286 286
     {
287 287
         $match = [];
288
-        $key = empty($this->handshakes[(int)$client]) ? 0 : $this->handshakes[(int)$client];
288
+        $key = empty($this->handshakes[(int) $client]) ? 0 : $this->handshakes[(int) $client];
289 289
         preg_match(self::SEC_WEBSOCKET_KEY_PTRN, $headers, $match);
290 290
         if (empty($match[1])) {
291 291
             return false;
292 292
         }
293 293
 
294 294
         $key = $match[1];
295
-        $this->handshakes[(int)$client] = $key;
295
+        $this->handshakes[(int) $client] = $key;
296 296
 
297 297
         // sending header according to WebSocket Protocol
298 298
         $secWebSocketAccept = base64_encode(sha1(trim($key) . self::HEADER_WEBSOCKET_ACCEPT_HASH, true));
Please login to merge, or discard this patch.
src/Components/WscMain.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         $header = 'GET ' . $path_with_query . " HTTP/1.1\r\n"
103 103
             . implode(
104 104
                 "\r\n", array_map(
105
-                    function ($key, $value) {
105
+                    function($key, $value) {
106 106
                         return "$key: $value";
107 107
                     }, array_keys($headers), $headers
108 108
                 )
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         // Binary string for header.
205 205
         $frameHeadBin = '';
206 206
         // Write FIN, final fragment bit.
207
-        $frameHeadBin .= (bool)$final ? '1' : '0';
207
+        $frameHeadBin .= (bool) $final ? '1' : '0';
208 208
         // RSV 1, 2, & 3 false and unused.
209 209
         $frameHeadBin .= '000';
210 210
         // Opcode rest of the byte.
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 
270 270
         // Is this the final fragment?  // Bit 0 in byte 0
271 271
         /// @todo Handle huge payloads with multiple fragments.
272
-        $final = (boolean)(ord($data[0]) & 1 << 7);
272
+        $final = (boolean) (ord($data[0]) & 1 << 7);
273 273
 
274 274
         // Should be unused, and must be false…  // Bits 1, 2, & 3
275 275
         //      $rsv1  = (boolean) (ord($data[0]) & 1 << 6);
@@ -289,12 +289,12 @@  discard block
 block discarded – undo
289 289
         }
290 290
 
291 291
         // Masking?
292
-        $mask = (boolean)(ord($data[1]) >> 7);  // Bit 0 in byte 1
292
+        $mask = (boolean) (ord($data[1]) >> 7); // Bit 0 in byte 1
293 293
 
294 294
         $payload = '';
295 295
 
296 296
         // Payload length
297
-        $payload_length = (integer)ord($data[1]) & self::MASK_127; // Bits 1-7 in byte 1
297
+        $payload_length = (integer) ord($data[1]) & self::MASK_127; // Bits 1-7 in byte 1
298 298
         if ($payload_length > self::MASK_125) {
299 299
             if ($payload_length === self::MASK_126) {
300 300
                 $data = $this->read(2); // 126: Payload is a 16-bit unsigned int
Please login to merge, or discard this patch.