@@ -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. |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | - * @return mixed|resource |
|
| 111 | + * @return resource|null |
|
| 112 | 112 | * @throws \InvalidArgumentException |
| 113 | 113 | */ |
| 114 | 114 | private function getStreamContext() |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | /** |
| 208 | 208 | * Sends message to opened socket connection client->server |
| 209 | 209 | * |
| 210 | - * @param $payload |
|
| 210 | + * @param string $payload |
|
| 211 | 211 | * @param string $opcode |
| 212 | 212 | * @throws \InvalidArgumentException |
| 213 | 213 | * @throws BadOpcodeException |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | * |
| 278 | 278 | * @param integer $status http://tools.ietf.org/html/rfc6455#section-7.4 |
| 279 | 279 | * @param string $message A closing message, max 125 bytes. |
| 280 | - * @return bool|null|string |
|
| 280 | + * @return null|string |
|
| 281 | 281 | * @throws \InvalidArgumentException |
| 282 | 282 | * @throws BadOpcodeException |
| 283 | 283 | * @throws BadUriException |
@@ -157,7 +157,7 @@ |
||
| 157 | 157 | return 'GET ' . $pathWithQuery . " HTTP/1.1\r\n" |
| 158 | 158 | . implode( |
| 159 | 159 | "\r\n", array_map( |
| 160 | - function ($key, $value) { |
|
| 160 | + function($key, $value) { |
|
| 161 | 161 | return "$key: $value"; |
| 162 | 162 | }, array_keys($headers), $headers |
| 163 | 163 | ) |