@@ -312,7 +312,7 @@ |
||
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | $key = $match[1]; |
| 315 | - $this->handshakes[(int)$client] = $key; |
|
| 315 | + $this->handshakes[(int) $client] = $key; |
|
| 316 | 316 | // sending header according to WebSocket Protocol |
| 317 | 317 | $secWebSocketAccept = base64_encode(sha1(trim($key) . self::HEADER_WEBSOCKET_ACCEPT_HASH, true)); |
| 318 | 318 | $this->setHeadersUpgrade($secWebSocketAccept); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | return 'GET ' . $pathWithQuery . " HTTP/1.1\r\n" |
| 160 | 160 | . implode( |
| 161 | 161 | "\r\n", array_map( |
| 162 | - function ($key, $value) { |
|
| 162 | + function($key, $value) { |
|
| 163 | 163 | return "$key: $value"; |
| 164 | 164 | }, array_keys($headers), $headers |
| 165 | 165 | ) |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | // Binary string for header. |
| 261 | 261 | $frameHeadBin = ''; |
| 262 | 262 | // Write FIN, final fragment bit. |
| 263 | - $frameHeadBin .= (bool)$final ? '1' : '0'; |
|
| 263 | + $frameHeadBin .= (bool) $final ? '1' : '0'; |
|
| 264 | 264 | // RSV 1, 2, & 3 false and unused. |
| 265 | 265 | $frameHeadBin .= '000'; |
| 266 | 266 | // Opcode rest of the byte. |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | |
| 331 | 331 | // Is this the final fragment? // Bit 0 in byte 0 |
| 332 | 332 | /// @todo Handle huge payloads with multiple fragments. |
| 333 | - $final = (bool)(ord($data[0]) & 1 << 7); |
|
| 333 | + $final = (bool) (ord($data[0]) & 1 << 7); |
|
| 334 | 334 | |
| 335 | 335 | // Parse opcode |
| 336 | 336 | $opcode_int = ord($data[0]) & 31; // Bits 4-7 |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | private function getPayloadData(string $data, int $payloadLength) |
| 391 | 391 | { |
| 392 | 392 | // Masking? |
| 393 | - $mask = (bool)(ord($data[1]) >> 7); // Bit 0 in byte 1 |
|
| 393 | + $mask = (bool) (ord($data[1]) >> 7); // Bit 0 in byte 1 |
|
| 394 | 394 | $payload = ''; |
| 395 | 395 | $maskingKey = ''; |
| 396 | 396 | // Get masking key. |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | */ |
| 421 | 421 | private function getPayloadLength(string $data) |
| 422 | 422 | { |
| 423 | - $payloadLength = (int)ord($data[1]) & self::MASK_127; // Bits 1-7 in byte 1 |
|
| 423 | + $payloadLength = (int) ord($data[1]) & self::MASK_127; // Bits 1-7 in byte 1 |
|
| 424 | 424 | if ($payloadLength > self::MASK_125) { |
| 425 | 425 | if ($payloadLength === self::MASK_126) { |
| 426 | 426 | $data = $this->read(2); // 126: Payload is a 16-bit unsigned int |
@@ -135,6 +135,6 @@ |
||
| 135 | 135 | */ |
| 136 | 136 | public function getUniqueSocketId(): int |
| 137 | 137 | { |
| 138 | - return (int)$this->socketConnection; |
|
| 138 | + return (int) $this->socketConnection; |
|
| 139 | 139 | } |
| 140 | 140 | } |