@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | $socket->write($server->protocol()->getPacket(Protocol::PACKET_CHALLENGE)); |
| 417 | 417 | |
| 418 | 418 | // Add the socket information so we can reference it easily |
| 419 | - $sockets[(int)$socket->get()] = [ |
|
| 419 | + $sockets[(int) $socket->get()] = [ |
|
| 420 | 420 | 'server_id' => $server_id, |
| 421 | 421 | 'socket' => $socket, |
| 422 | 422 | ]; |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | unset($packets); |
| 518 | 518 | |
| 519 | 519 | // Add the socket information so we can reference it easily |
| 520 | - $sockets[(int)$socket->get()] = [ |
|
| 520 | + $sockets[(int) $socket->get()] = [ |
|
| 521 | 521 | 'server_id' => $server_id, |
| 522 | 522 | 'socket' => $socket, |
| 523 | 523 | ]; |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | $results['gq_port_client'] = $server->portClient(); |
| 614 | 614 | $results['gq_port_query'] = (isset($results['gq_port_query'])) ? $results['gq_port_query'] : $server->portQuery(); |
| 615 | 615 | $results['gq_protocol'] = $server->protocol()->getProtocol(); |
| 616 | - $results['gq_type'] = (string)$server->protocol(); |
|
| 616 | + $results['gq_type'] = (string) $server->protocol(); |
|
| 617 | 617 | $results['gq_name'] = $server->protocol()->nameLong(); |
| 618 | 618 | $results['gq_transport'] = $server->protocol()->transport(); |
| 619 | 619 | $results['gq_custom'] = $server->getCustom(); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $server_addr = explode(':', $ip_address); |
| 184 | 184 | |
| 185 | 185 | // Port is the last item in the array, remove it and save |
| 186 | - $this->port_client = (int)array_pop($server_addr); |
|
| 186 | + $this->port_client = (int) array_pop($server_addr); |
|
| 187 | 187 | |
| 188 | 188 | // The rest is the address, recombine |
| 189 | 189 | $this->ip = implode(':', $server_addr); |
@@ -198,17 +198,17 @@ discard block |
||
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | // Now let's validate the IPv6 value sent, remove the square brackets ([]) first |
| 201 | - if (!filter_var(trim($this->ip, '[]'), FILTER_VALIDATE_IP, ['flags' => FILTER_FLAG_IPV6,])) { |
|
| 201 | + if (!filter_var(trim($this->ip, '[]'), FILTER_VALIDATE_IP, ['flags' => FILTER_FLAG_IPV6, ])) { |
|
| 202 | 202 | throw new Exception("The IPv6 address '{$this->ip}' is invalid."); |
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | - else if($type != 'discord') { |
|
| 205 | + else if ($type != 'discord') { |
|
| 206 | 206 | // We have IPv4 with a port defined |
| 207 | 207 | if (strstr($ip_address, ':')) { |
| 208 | 208 | list($this->ip, $this->port_client) = explode(':', $ip_address); |
| 209 | 209 | |
| 210 | 210 | // Type case the port |
| 211 | - $this->port_client = (int)$this->port_client; |
|
| 211 | + $this->port_client = (int) $this->port_client; |
|
| 212 | 212 | } else { |
| 213 | 213 | // No port, fail |
| 214 | 214 | throw new Exception( |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | // Validate the IPv4 value, if FALSE is not a valid IP, maybe a hostname. |
| 221 | - if (! filter_var($this->ip, FILTER_VALIDATE_IP, ['flags' => FILTER_FLAG_IPV4,])) { |
|
| 221 | + if (!filter_var($this->ip, FILTER_VALIDATE_IP, ['flags' => FILTER_FLAG_IPV4, ])) { |
|
| 222 | 222 | // Try to resolve the hostname to IPv4 |
| 223 | 223 | $resolved = gethostbyname($this->ip); |
| 224 | 224 | |
@@ -233,13 +233,13 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | // ! HURAAYYY, IGNORE IF TYPE IS DISCORD |
| 235 | 235 | // ! AND SET PORT/QPORT AS 1 AND ONLY 1 |
| 236 | - }else{ |
|
| 236 | + } else { |
|
| 237 | 237 | if (strstr($ip_address, ':')) { |
| 238 | 238 | list($this->ip, $this->port_client) = explode(':', $ip_address); |
| 239 | 239 | |
| 240 | 240 | // Type case the port |
| 241 | 241 | $this->options['invite'] = $this->port_client; |
| 242 | - if(is_string($this->port_client)){ |
|
| 242 | + if (is_string($this->port_client)) { |
|
| 243 | 243 | $this->port_client = 1; |
| 244 | 244 | } |
| 245 | 245 | } else { |
@@ -260,8 +260,8 @@ discard block |
||
| 260 | 260 | |
| 261 | 261 | // Specific query port defined |
| 262 | 262 | if (array_key_exists(self::SERVER_OPTIONS_QUERY_PORT, $this->options)) { |
| 263 | - $this->port_query = (int)$this->options[self::SERVER_OPTIONS_QUERY_PORT]; |
|
| 264 | - }else{ |
|
| 263 | + $this->port_query = (int) $this->options[self::SERVER_OPTIONS_QUERY_PORT]; |
|
| 264 | + } else { |
|
| 265 | 265 | // Do math based on the protocol class |
| 266 | 266 | $this->port_query = $this->protocol->findQueryPort($this->port_client); |
| 267 | 267 | } |
@@ -201,8 +201,7 @@ discard block |
||
| 201 | 201 | if (!filter_var(trim($this->ip, '[]'), FILTER_VALIDATE_IP, ['flags' => FILTER_FLAG_IPV6,])) { |
| 202 | 202 | throw new Exception("The IPv6 address '{$this->ip}' is invalid."); |
| 203 | 203 | } |
| 204 | - } |
|
| 205 | - else if($type != 'discord') { |
|
| 204 | + } else if($type != 'discord') { |
|
| 206 | 205 | // We have IPv4 with a port defined |
| 207 | 206 | if (strstr($ip_address, ':')) { |
| 208 | 207 | list($this->ip, $this->port_client) = explode(':', $ip_address); |
@@ -233,7 +232,7 @@ discard block |
||
| 233 | 232 | |
| 234 | 233 | // ! HURAAYYY, IGNORE IF TYPE IS DISCORD |
| 235 | 234 | // ! AND SET PORT/QPORT AS 1 AND ONLY 1 |
| 236 | - }else{ |
|
| 235 | + } else{ |
|
| 237 | 236 | if (strstr($ip_address, ':')) { |
| 238 | 237 | list($this->ip, $this->port_client) = explode(':', $ip_address); |
| 239 | 238 | |
@@ -261,7 +260,7 @@ discard block |
||
| 261 | 260 | // Specific query port defined |
| 262 | 261 | if (array_key_exists(self::SERVER_OPTIONS_QUERY_PORT, $this->options)) { |
| 263 | 262 | $this->port_query = (int)$this->options[self::SERVER_OPTIONS_QUERY_PORT]; |
| 264 | - }else{ |
|
| 263 | + } else{ |
|
| 265 | 264 | // Do math based on the protocol class |
| 266 | 265 | $this->port_query = $this->protocol->findQueryPort($this->port_client); |
| 267 | 266 | } |
@@ -253,9 +253,9 @@ |
||
| 253 | 253 | */ |
| 254 | 254 | public function findQueryPort($clientPort) |
| 255 | 255 | { |
| 256 | - if(!$this->protocol != 'discord'){ |
|
| 256 | + if (!$this->protocol != 'discord') { |
|
| 257 | 257 | return $clientPort + $this->port_diff; |
| 258 | - }else{ |
|
| 258 | + } else { |
|
| 259 | 259 | return 1; |
| 260 | 260 | } |
| 261 | 261 | } |
@@ -255,7 +255,7 @@ |
||
| 255 | 255 | { |
| 256 | 256 | if(!$this->protocol != 'discord'){ |
| 257 | 257 | return $clientPort + $this->port_diff; |
| 258 | - }else{ |
|
| 258 | + } else{ |
|
| 259 | 259 | return 1; |
| 260 | 260 | } |
| 261 | 261 | } |
@@ -192,12 +192,12 @@ |
||
| 192 | 192 | $serverFlags = $buffer->readInt8(); |
| 193 | 193 | |
| 194 | 194 | // Read server flags |
| 195 | - $result->add('password', (int)$this->readFlag($serverFlags, 0)); |
|
| 196 | - $result->add('registered_only', (int)$this->readFlag($serverFlags, 1)); |
|
| 197 | - $result->add('fog_of_war', (int)$this->readFlag($serverFlags, 2)); |
|
| 198 | - $result->add('friendly_fire', (int)$this->readFlag($serverFlags, 3)); |
|
| 199 | - $result->add('bots_enabled', (int)$this->readFlag($serverFlags, 5)); |
|
| 200 | - $result->add('lua_scripts', (int)$this->readFlag($serverFlags, 6)); |
|
| 195 | + $result->add('password', (int) $this->readFlag($serverFlags, 0)); |
|
| 196 | + $result->add('registered_only', (int) $this->readFlag($serverFlags, 1)); |
|
| 197 | + $result->add('fog_of_war', (int) $this->readFlag($serverFlags, 2)); |
|
| 198 | + $result->add('friendly_fire', (int) $this->readFlag($serverFlags, 3)); |
|
| 199 | + $result->add('bots_enabled', (int) $this->readFlag($serverFlags, 5)); |
|
| 200 | + $result->add('lua_scripts', (int) $this->readFlag($serverFlags, 6)); |
|
| 201 | 201 | |
| 202 | 202 | // Read the rest of the buffer data |
| 203 | 203 | // mb_convert_encoding($string, 'UTF-8'); |
@@ -171,10 +171,10 @@ |
||
| 171 | 171 | $result->add('password', $buffer->readString()); |
| 172 | 172 | $result->add('numplayers', $buffer->readInt16()); |
| 173 | 173 | $result->add('maxplayers', $buffer->readInt16()); |
| 174 | - $result->add('servername', mb_convert_encoding($buffer->readPascalString(), 'UTF-8')); |
|
| 174 | + $result->add('servername', mb_convert_encoding($buffer->readPascalString(), 'UTF-8')); |
|
| 175 | 175 | $result->add('gamemode', $buffer->readPascalString()); |
| 176 | - $result->add('website', mb_convert_encoding($buffer->readPascalString(), 'UTF-8')); |
|
| 177 | - $result->add('mapname', mb_convert_encoding($buffer->readPascalString(), 'UTF-8')); |
|
| 176 | + $result->add('website', mb_convert_encoding($buffer->readPascalString(), 'UTF-8')); |
|
| 177 | + $result->add('mapname', mb_convert_encoding($buffer->readPascalString(), 'UTF-8')); |
|
| 178 | 178 | |
| 179 | 179 | unset($buffer); |
| 180 | 180 | |