@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $server_addr = explode(':', $ip_address); |
171 | 171 | |
172 | 172 | // Port is the last item in the array, remove it and save |
173 | - $this->port_client = (int)array_pop($server_addr); |
|
173 | + $this->port_client = (int) array_pop($server_addr); |
|
174 | 174 | |
175 | 175 | // The rest is the address, recombine |
176 | 176 | $this->ip = implode(':', $server_addr); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | // Now let's validate the IPv6 value sent, remove the square brackets ([]) first |
188 | - if (!filter_var(trim($this->ip, '[]'), FILTER_VALIDATE_IP, ['flags' => FILTER_FLAG_IPV6,])) { |
|
188 | + if (!filter_var(trim($this->ip, '[]'), FILTER_VALIDATE_IP, ['flags' => FILTER_FLAG_IPV6, ])) { |
|
189 | 189 | throw new Exception("The IPv6 address '{$this->ip}' is invalid."); |
190 | 190 | } |
191 | 191 | } else { |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | list($this->ip, $this->port_client) = explode(':', $ip_address); |
195 | 195 | |
196 | 196 | // Type case the port |
197 | - $this->port_client = (int)$this->port_client; |
|
197 | + $this->port_client = (int) $this->port_client; |
|
198 | 198 | } else { |
199 | 199 | // No port, fail |
200 | 200 | throw new Exception( |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | } |
205 | 205 | |
206 | 206 | // Validate the IPv4 value, if FALSE is not a valid IP, maybe a hostname. |
207 | - if (! filter_var($this->ip, FILTER_VALIDATE_IP, ['flags' => FILTER_FLAG_IPV4,])) { |
|
207 | + if (!filter_var($this->ip, FILTER_VALIDATE_IP, ['flags' => FILTER_FLAG_IPV4, ])) { |
|
208 | 208 | // Try to resolve the hostname to IPv4 |
209 | 209 | $resolved = gethostbyname($this->ip); |
210 | 210 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | // Specific query port defined |
229 | 229 | if (array_key_exists(self::SERVER_OPTIONS_QUERY_PORT, $this->options)) { |
230 | - $this->port_query = (int)$this->options[self::SERVER_OPTIONS_QUERY_PORT]; |
|
230 | + $this->port_query = (int) $this->options[self::SERVER_OPTIONS_QUERY_PORT]; |
|
231 | 231 | } else { |
232 | 232 | // Do math based on the protocol class |
233 | 233 | $this->port_query = $this->protocol->findQueryPort($this->port_client); |
@@ -227,7 +227,7 @@ |
||
227 | 227 | * |
228 | 228 | * @throws Exception |
229 | 229 | */ |
230 | - protected function parsePlayerTeam($dataType, Buffer &$buffer, Result &$result) |
|
230 | + protected function parsePlayerTeam($dataType, Buffer & $buffer, Result & $result) |
|
231 | 231 | { |
232 | 232 | |
233 | 233 | // Do count |
@@ -191,7 +191,7 @@ |
||
191 | 191 | $result->addSub('mods', 'steam_id', $responseBuffer->readInt32($infoByte & 0x0F)); |
192 | 192 | |
193 | 193 | // Read the name of the mod |
194 | - $result->addSub('mods', 'name', $responseBuffer->readPascalString(0, true) ?: 'Unknown'); |
|
194 | + $result->addSub('mods', 'name', $responseBuffer->readPascalString(0, true) ? : 'Unknown'); |
|
195 | 195 | |
196 | 196 | --$modCount; |
197 | 197 | } |
@@ -147,16 +147,16 @@ |
||
147 | 147 | |
148 | 148 | $result->add('edition', $info[0]); |
149 | 149 | $result->add('motd_line_1', $info[1]); |
150 | - $result->add('protocol_version', (int)$info[2]); |
|
150 | + $result->add('protocol_version', (int) $info[2]); |
|
151 | 151 | $result->add('version', $info[3]); |
152 | - $result->add('num_players', (int)$info[4]); |
|
153 | - $result->add('max_players', (int)$info[5]); |
|
152 | + $result->add('num_players', (int) $info[4]); |
|
153 | + $result->add('max_players', (int) $info[5]); |
|
154 | 154 | $result->add('server_uid', $info[6]); |
155 | 155 | $result->add('motd_line_2', $info[7]); |
156 | 156 | $result->add('gamemode', $info[8]); |
157 | - $result->add('gamemode_numeric', (int)$info[9]); |
|
158 | - $result->add('port_ipv4', (isset($info[10])) ? (int)$info[10] : null); |
|
159 | - $result->add('port_ipv6', (isset($info[11])) ? (int)$info[11] : null); |
|
157 | + $result->add('gamemode_numeric', (int) $info[9]); |
|
158 | + $result->add('port_ipv4', (isset($info[10])) ? (int) $info[10] : null); |
|
159 | + $result->add('port_ipv6', (isset($info[11])) ? (int) $info[11] : null); |
|
160 | 160 | $result->add('dedicated', 1); |
161 | 161 | |
162 | 162 | unset($header, $serverGUID, $magicCheck, $info); |
@@ -105,14 +105,12 @@ discard block |
||
105 | 105 | $parsed = TRUE; |
106 | 106 | |
107 | 107 | $results['server.tags'][] = $gametag; |
108 | - } |
|
109 | - elseif (in_array(mb_strtolower($gametag), $this->region_tags)) |
|
108 | + } elseif (in_array(mb_strtolower($gametag), $this->region_tags)) |
|
110 | 109 | { |
111 | 110 | $parsed = TRUE; |
112 | 111 | |
113 | 112 | $results['region'] = mb_strtoupper($gametag); |
114 | - } |
|
115 | - else |
|
113 | + } else |
|
116 | 114 | { |
117 | 115 | foreach ($this->server_keywords as $server_keyword) |
118 | 116 | { |
@@ -123,8 +121,7 @@ discard block |
||
123 | 121 | if ($gametag == $server_keyword) |
124 | 122 | { |
125 | 123 | $results['server.keywords'][$gametag] = TRUE; |
126 | - } |
|
127 | - else |
|
124 | + } else |
|
128 | 125 | { |
129 | 126 | $results['server.keywords'][$server_keyword] = mb_substr($gametag, mb_strlen($server_keyword)); |
130 | 127 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | { |
88 | 88 | $results = parent::processDetails($buffer); |
89 | 89 | |
90 | - if (isset($results['keywords']) AND strlen($results['keywords']) > 0) |
|
90 | + if (isset($results['keywords']) and strlen($results['keywords']) > 0) |
|
91 | 91 | { |
92 | 92 | $keywords = explode(',', $results['keywords']); |
93 | 93 | if (sizeof($keywords) > 0) |
@@ -98,17 +98,17 @@ discard block |
||
98 | 98 | |
99 | 99 | foreach ($keywords as $gametag) |
100 | 100 | { |
101 | - $parsed = FALSE; |
|
101 | + $parsed = false; |
|
102 | 102 | |
103 | 103 | if (in_array($gametag, $this->server_tags)) |
104 | 104 | { |
105 | - $parsed = TRUE; |
|
105 | + $parsed = true; |
|
106 | 106 | |
107 | 107 | $results['server.tags'][] = $gametag; |
108 | 108 | } |
109 | 109 | elseif (in_array(mb_strtolower($gametag), $this->region_tags)) |
110 | 110 | { |
111 | - $parsed = TRUE; |
|
111 | + $parsed = true; |
|
112 | 112 | |
113 | 113 | $results['region'] = mb_strtoupper($gametag); |
114 | 114 | } |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | { |
119 | 119 | if (strpos($gametag, $server_keyword) === 0) |
120 | 120 | { |
121 | - $parsed = TRUE; |
|
121 | + $parsed = true; |
|
122 | 122 | |
123 | 123 | if ($gametag == $server_keyword) |
124 | 124 | { |
125 | - $results['server.keywords'][$gametag] = TRUE; |
|
125 | + $results['server.keywords'][$gametag] = true; |
|
126 | 126 | } |
127 | 127 | else |
128 | 128 | { |