@@ -224,13 +224,13 @@ discard block |
||
224 | 224 | |
225 | 225 | // These are the same no matter what mode the server is in |
226 | 226 | $result->add('hostname', $items[1]); |
227 | - $result->add('num_players', (int)$items[2]); |
|
228 | - $result->add('max_players', (int)$items[3]); |
|
227 | + $result->add('num_players', (int) $items[2]); |
|
228 | + $result->add('max_players', (int) $items[3]); |
|
229 | 229 | $result->add('gametype', $items[4]); |
230 | 230 | $result->add('map', $items[5]); |
231 | - $result->add('roundsplayed', (int)$items[6]); |
|
232 | - $result->add('roundstotal', (int)$items[7]); |
|
233 | - $result->add('num_teams', (int)$items[8]); |
|
231 | + $result->add('roundsplayed', (int) $items[6]); |
|
232 | + $result->add('roundstotal', (int) $items[7]); |
|
233 | + $result->add('num_teams', (int) $items[8]); |
|
234 | 234 | |
235 | 235 | // Set the current index |
236 | 236 | $index_current = 9; |
@@ -247,13 +247,13 @@ discard block |
||
247 | 247 | } |
248 | 248 | |
249 | 249 | // Get and set the rest of the data points. |
250 | - $result->add('targetscore', (int)$items[$index_current]); |
|
250 | + $result->add('targetscore', (int) $items[$index_current]); |
|
251 | 251 | $result->add('online', 1); // Forced true, shows accepting players |
252 | 252 | $result->add('ranked', (($items[$index_current + 2] == 'true') ? 1 : 0)); |
253 | 253 | $result->add('punkbuster', (($items[$index_current + 3] == 'true') ? 1 : 0)); |
254 | 254 | $result->add('password', (($items[$index_current + 4] == 'true') ? 1 : 0)); |
255 | - $result->add('uptime', (int)$items[$index_current + 5]); |
|
256 | - $result->add('roundtime', (int)$items[$index_current + 6]); |
|
255 | + $result->add('uptime', (int) $items[$index_current + 5]); |
|
256 | + $result->add('roundtime', (int) $items[$index_current + 6]); |
|
257 | 257 | $result->add('mod', $items[$index_current + 7]); |
258 | 258 | |
259 | 259 | $result->add('ip_port', $items[$index_current + 9]); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @param Buffer $buffer |
188 | 188 | * @param Result $result |
189 | 189 | */ |
190 | - protected function parsePlayers(Buffer &$buffer, Result &$result) |
|
190 | + protected function parsePlayers(Buffer & $buffer, Result & $result) |
|
191 | 191 | { |
192 | 192 | // By default there are 0 players |
193 | 193 | $players = 0; |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @param Buffer $buffer |
217 | 217 | * @param Result $result |
218 | 218 | */ |
219 | - protected function parsePlayersExtra(Buffer &$buffer, Result &$result) |
|
219 | + protected function parsePlayersExtra(Buffer & $buffer, Result & $result) |
|
220 | 220 | { |
221 | 221 | // Iterate over the extra player info |
222 | 222 | while (($id = $buffer->readInt8()) != 32) { |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * @param string $data |
252 | 252 | * @param \GameQ\Result $result |
253 | 253 | */ |
254 | - protected function processDetails($data, Result &$result) |
|
254 | + protected function processDetails($data, Result & $result) |
|
255 | 255 | { |
256 | 256 | |
257 | 257 | // Offload the parsing for these values |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * @param string $data |
281 | 281 | * @param \GameQ\Result $result |
282 | 282 | */ |
283 | - protected function processChannels($data, Result &$result) |
|
283 | + protected function processChannels($data, Result & $result) |
|
284 | 284 | { |
285 | 285 | |
286 | 286 | // We need to split the data at the pipe |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * @param string $data |
307 | 307 | * @param \GameQ\Result $result |
308 | 308 | */ |
309 | - protected function processPlayers($data, Result &$result) |
|
309 | + protected function processPlayers($data, Result & $result) |
|
310 | 310 | { |
311 | 311 | |
312 | 312 | // We need to split the data at the pipe |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param Buffer $buffer |
99 | 99 | * @param Result $result |
100 | 100 | */ |
101 | - protected function processDetails(Buffer &$buffer, Result &$result) |
|
101 | + protected function processDetails(Buffer & $buffer, Result & $result) |
|
102 | 102 | { |
103 | 103 | parent::processDetails($buffer, $result); |
104 | 104 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @see Gamespy3::processPlayersAndTeams() |
117 | 117 | */ |
118 | - protected function processPlayersAndTeams(Buffer &$buffer, Result &$result) |
|
118 | + protected function processPlayersAndTeams(Buffer & $buffer, Result & $result) |
|
119 | 119 | { |
120 | 120 | // Loop until we run out of data |
121 | 121 | while ($buffer->getLength()) { |
@@ -154,7 +154,7 @@ |
||
154 | 154 | $result->add('serverversion', $json->ServerVersion); |
155 | 155 | $result->add('map', ((!empty($json->Map)) ? $json->Map : 'Los Santos/Blaine Country')); |
156 | 156 | $result->add('mod', $json->Gamemode); |
157 | - $result->add('password', (int)$json->Passworded); |
|
157 | + $result->add('password', (int) $json->Passworded); |
|
158 | 158 | $result->add('numplayers', $json->CurrentPlayers); |
159 | 159 | $result->add('maxplayers', $json->MaxPlayers); |
160 | 160 |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | $socket->write($server->protocol()->getPacket(Protocol::PACKET_CHALLENGE)); |
405 | 405 | |
406 | 406 | // Add the socket information so we can reference it easily |
407 | - $sockets[(int)$socket->get()] = [ |
|
407 | + $sockets[(int) $socket->get()] = [ |
|
408 | 408 | 'server_id' => $server_id, |
409 | 409 | 'socket' => $socket, |
410 | 410 | ]; |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | unset($packets); |
506 | 506 | |
507 | 507 | // Add the socket information so we can reference it easily |
508 | - $sockets[(int)$socket->get()] = [ |
|
508 | + $sockets[(int) $socket->get()] = [ |
|
509 | 509 | 'server_id' => $server_id, |
510 | 510 | 'socket' => $socket, |
511 | 511 | ]; |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | $results['gq_port_client'] = $server->portClient(); |
602 | 602 | $results['gq_port_query'] = (isset($results['gq_port_query'])) ? $results['gq_port_query'] : $server->portQuery(); |
603 | 603 | $results['gq_protocol'] = $server->protocol()->getProtocol(); |
604 | - $results['gq_type'] = (string)$server->protocol(); |
|
604 | + $results['gq_type'] = (string) $server->protocol(); |
|
605 | 605 | $results['gq_name'] = $server->protocol()->nameLong(); |
606 | 606 | $results['gq_transport'] = $server->protocol()->transport(); |
607 | 607 |
@@ -129,11 +129,11 @@ |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | // Add the result |
132 | - $result->add($key, (string)$value); |
|
132 | + $result->add($key, (string) $value); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | - $result->add("motd", (string)$xmlDoc->motd); |
|
136 | + $result->add("motd", (string) $xmlDoc->motd); |
|
137 | 137 | |
138 | 138 | unset($xmlDoc, $xmlDoc); |
139 | 139 |
@@ -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 | $result->add('servername', utf8_encode($buffer->readPascalString(0))); |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | $result->add('num_grfs', $num_grfs); |
139 | 139 | //$buffer->skip ($num_grfs * 20); #skip grfs id and md5 hash |
140 | 140 | |
141 | - for ($i=0; $i<$num_grfs; $i++) { |
|
142 | - $result->add('grfs_'.$i.'_ID', strtoupper(bin2hex($buffer->read(4)))); |
|
143 | - $result->add('grfs_'.$i.'_MD5', strtoupper(bin2hex($buffer->read(16)))); |
|
141 | + for ($i = 0; $i < $num_grfs; $i++) { |
|
142 | + $result->add('grfs_' . $i . '_ID', strtoupper(bin2hex($buffer->read(4)))); |
|
143 | + $result->add('grfs_' . $i . '_MD5', strtoupper(bin2hex($buffer->read(16)))); |
|
144 | 144 | } |
145 | 145 | // No break, cascades all the down even if case is meet |
146 | 146 | case 3: |
@@ -158,14 +158,14 @@ discard block |
||
158 | 158 | |
159 | 159 | $language = $buffer->readInt8(); |
160 | 160 | $result->add('language', $language); |
161 | - $result->add('language_icon', '//media.openttd.org/images/server/'.$language.'_lang.gif'); |
|
161 | + $result->add('language_icon', '//media.openttd.org/images/server/' . $language . '_lang.gif'); |
|
162 | 162 | |
163 | 163 | $result->add('password', $buffer->readInt8()); |
164 | 164 | $result->add('max_clients', $buffer->readInt8()); |
165 | 165 | $result->add('clients', $buffer->readInt8()); |
166 | 166 | $result->add('spectators', $buffer->readInt8()); |
167 | 167 | if ($protocol_version < 3) { |
168 | - $days = ( 365 * 1920 + 1920 / 4 - 1920 / 100 + 1920 / 400 ); |
|
168 | + $days = (365 * 1920 + 1920 / 4 - 1920 / 100 + 1920 / 400); |
|
169 | 169 | $result->add('game_date', $buffer->readInt16() + $days); |
170 | 170 | $result->add('start_date', $buffer->readInt16() + $days); |
171 | 171 | } |