@@ -327,7 +327,7 @@ |
||
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | $key = $match[1]; |
| 330 | - $this->handshakes[(int)$client] = $key; |
|
| 330 | + $this->handshakes[(int) $client] = $key; |
|
| 331 | 331 | |
| 332 | 332 | // sending header according to WebSocket Protocol |
| 333 | 333 | $secWebSocketAccept = base64_encode(sha1(trim($key) . self::HEADER_WEBSOCKET_ACCEPT_HASH, true)); |
@@ -139,7 +139,7 @@ |
||
| 139 | 139 | */ |
| 140 | 140 | public function getUniqueSocketId(): int |
| 141 | 141 | { |
| 142 | - return (int)$this->socketConnection; |
|
| 142 | + return (int) $this->socketConnection; |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -184,10 +184,10 @@ |
||
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
| 187 | - * @param $final |
|
| 188 | - * @param $payload |
|
| 189 | - * @param $opcode |
|
| 190 | - * @param $masked |
|
| 187 | + * @param boolean $final |
|
| 188 | + * @param string $payload |
|
| 189 | + * @param string $opcode |
|
| 190 | + * @param boolean $masked |
|
| 191 | 191 | * @throws ConnectionException |
| 192 | 192 | * @throws \Exception |
| 193 | 193 | */ |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | private function getPayloadLength(string $data) |
| 65 | 65 | { |
| 66 | - $payloadLength = (int)ord($data[1]) & self::MASK_127; // Bits 1-7 in byte 1 |
|
| 66 | + $payloadLength = (int) ord($data[1]) & self::MASK_127; // Bits 1-7 in byte 1 |
|
| 67 | 67 | if ($payloadLength > self::MASK_125) { |
| 68 | 68 | if ($payloadLength === self::MASK_126) { |
| 69 | 69 | $data = $this->read(2); // 126: Payload is a 16-bit unsigned int |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | private function getPayloadData(string $data, int $payloadLength): string |
| 86 | 86 | { |
| 87 | 87 | // Masking? |
| 88 | - $mask = (bool)(ord($data[1]) >> 7); // Bit 0 in byte 1 |
|
| 88 | + $mask = (bool) (ord($data[1]) >> 7); // Bit 0 in byte 1 |
|
| 89 | 89 | $payload = ''; |
| 90 | 90 | $maskingKey = ''; |
| 91 | 91 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | // Is this the final fragment? // Bit 0 in byte 0 |
| 129 | 129 | /// @todo Handle huge payloads with multiple fragments. |
| 130 | - $final = (bool)(ord($data[0]) & 1 << 7); |
|
| 130 | + $final = (bool) (ord($data[0]) & 1 << 7); |
|
| 131 | 131 | |
| 132 | 132 | // Parse opcode |
| 133 | 133 | $opcode_int = ord($data[0]) & 31; // Bits 4-7 |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | // Binary string for header. |
| 197 | 197 | $frameHeadBin = ''; |
| 198 | 198 | // Write FIN, final fragment bit. |
| 199 | - $frameHeadBin .= (bool)$final ? '1' : '0'; |
|
| 199 | + $frameHeadBin .= (bool) $final ? '1' : '0'; |
|
| 200 | 200 | // RSV 1, 2, & 3 false and unused. |
| 201 | 201 | $frameHeadBin .= '000'; |
| 202 | 202 | // Opcode rest of the byte. |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | |
| 156 | 156 | /** |
| 157 | - * @return mixed|resource |
|
| 157 | + * @return resource|null |
|
| 158 | 158 | * @throws \InvalidArgumentException |
| 159 | 159 | */ |
| 160 | 160 | private function getStreamContext() |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | /** |
| 258 | 258 | * Sends message to opened socket connection client->server |
| 259 | 259 | * |
| 260 | - * @param $payload |
|
| 260 | + * @param string $payload |
|
| 261 | 261 | * @param string $opcode |
| 262 | 262 | * @throws \InvalidArgumentException |
| 263 | 263 | * @throws BadOpcodeException |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | * |
| 330 | 330 | * @param integer $status http://tools.ietf.org/html/rfc6455#section-7.4 |
| 331 | 331 | * @param string $message A closing message, max 125 bytes. |
| 332 | - * @return bool|null|string |
|
| 332 | + * @return null|string |
|
| 333 | 333 | * @throws \InvalidArgumentException |
| 334 | 334 | * @throws BadOpcodeException |
| 335 | 335 | * @throws BadUriException |
@@ -205,7 +205,7 @@ |
||
| 205 | 205 | . implode( |
| 206 | 206 | "\r\n", |
| 207 | 207 | array_map( |
| 208 | - function ($key, $value) { |
|
| 208 | + function($key, $value) { |
|
| 209 | 209 | return "$key: $value"; |
| 210 | 210 | }, |
| 211 | 211 | array_keys($headers), |
@@ -204,7 +204,7 @@ |
||
| 204 | 204 | */ |
| 205 | 205 | public function setProxyAuth(string $userName, string $password): void |
| 206 | 206 | { |
| 207 | - $this->proxyAuth = (empty($userName) === false && empty($password) === false) ? base64_encode($userName.':'.$password) : null; |
|
| 207 | + $this->proxyAuth = (empty($userName) === false && empty($password) === false) ? base64_encode($userName . ':' . $password) : null; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | /** |