@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $server_addr = explode(':', $ip_address); |
162 | 162 | |
163 | 163 | // Port is the last item in the array, remove it and save |
164 | - $this->port_client = (int)array_pop($server_addr); |
|
164 | + $this->port_client = (int) array_pop($server_addr); |
|
165 | 165 | |
166 | 166 | // The rest is the address, recombine |
167 | 167 | $this->ip = implode(':', $server_addr); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | } |
177 | 177 | |
178 | 178 | // Now let's validate the IPv6 value sent, remove the square brackets ([]) first |
179 | - if (!filter_var(trim($this->ip, '[]'), FILTER_VALIDATE_IP, ['flags' => FILTER_FLAG_IPV6,])) { |
|
179 | + if (!filter_var(trim($this->ip, '[]'), FILTER_VALIDATE_IP, ['flags' => FILTER_FLAG_IPV6, ])) { |
|
180 | 180 | throw new Exception("The IPv6 address '{$this->ip}' is invalid."); |
181 | 181 | } |
182 | 182 | } else { |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | list($this->ip, $this->port_client) = explode(':', $ip_address); |
186 | 186 | |
187 | 187 | // Type case the port |
188 | - $this->port_client = (int)$this->port_client; |
|
188 | + $this->port_client = (int) $this->port_client; |
|
189 | 189 | } else { |
190 | 190 | // No port, fail |
191 | 191 | throw new Exception( |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | } |
196 | 196 | |
197 | 197 | // Validate the IPv4 value, if FALSE is not a valid IP, maybe a hostname. |
198 | - if (! filter_var($this->ip, FILTER_VALIDATE_IP, ['flags' => FILTER_FLAG_IPV4,])) { |
|
198 | + if (!filter_var($this->ip, FILTER_VALIDATE_IP, ['flags' => FILTER_FLAG_IPV4, ])) { |
|
199 | 199 | // Try to resolve the hostname to IPv4 |
200 | 200 | $resolved = gethostbyname($this->ip); |
201 | 201 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | { |
218 | 218 | // Specific query port defined |
219 | 219 | if (array_key_exists(self::SERVER_OPTIONS_QUERY_PORT, $this->options)) { |
220 | - $this->port_query = (int)$this->options[self::SERVER_OPTIONS_QUERY_PORT]; |
|
220 | + $this->port_query = (int) $this->options[self::SERVER_OPTIONS_QUERY_PORT]; |
|
221 | 221 | } else { |
222 | 222 | // Do math based on the protocol class |
223 | 223 | $this->port_query = $this->protocol->findQueryPort($this->port_client); |
@@ -160,7 +160,7 @@ |
||
160 | 160 | * @param array $data |
161 | 161 | * @param \GameQ\Result $result |
162 | 162 | */ |
163 | - protected function processChannelsAndUsers(array $data, Result &$result) |
|
163 | + protected function processChannelsAndUsers(array $data, Result & $result) |
|
164 | 164 | { |
165 | 165 | // Let's add all of the channel information |
166 | 166 | foreach ($data as $key => $value) { |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | * @param \GameQ\Result $result |
834 | 834 | * @return void |
835 | 835 | */ |
836 | - protected function processChannel($data, $fieldCount, Result &$result) |
|
836 | + protected function processChannel($data, $fieldCount, Result & $result) |
|
837 | 837 | { |
838 | 838 | // Split the items on the comma |
839 | 839 | $items = explode(",", $data, $fieldCount); |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | * @param \GameQ\Result $result |
856 | 856 | * @return void |
857 | 857 | */ |
858 | - protected function processPlayer($data, $fieldCount, Result &$result) |
|
858 | + protected function processPlayer($data, $fieldCount, Result & $result) |
|
859 | 859 | { |
860 | 860 | // Split the items on the comma |
861 | 861 | $items = explode(",", $data, $fieldCount); |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | $result->add('num_grfs', $num_grfs); |
133 | 133 | //$buffer->skip ($num_grfs * 20); #skip grfs id and md5 hash |
134 | 134 | |
135 | - for ($i=0; $i<$num_grfs; $i++) { |
|
136 | - $result->add('grfs_'.$i.'_ID', strtoupper(bin2hex($buffer->read(4)))); |
|
137 | - $result->add('grfs_'.$i.'_MD5', strtoupper(bin2hex($buffer->read(16)))); |
|
135 | + for ($i = 0; $i < $num_grfs; $i++) { |
|
136 | + $result->add('grfs_' . $i . '_ID', strtoupper(bin2hex($buffer->read(4)))); |
|
137 | + $result->add('grfs_' . $i . '_MD5', strtoupper(bin2hex($buffer->read(16)))); |
|
138 | 138 | } |
139 | 139 | // no break, cascades all the down even if case is meet |
140 | 140 | case 3: |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | $language = $buffer->readInt8(); |
156 | 156 | $result->add('language', $language); |
157 | - $result->add('language_icon', '//media.openttd.org/images/server/'.$language.'_lang.gif'); |
|
157 | + $result->add('language_icon', '//media.openttd.org/images/server/' . $language . '_lang.gif'); |
|
158 | 158 | |
159 | 159 | $result->add('password', $buffer->readInt8()); |
160 | 160 | $result->add('max_clients', $buffer->readInt8()); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @return void |
198 | 198 | * @throws \GameQ\Exception\Protocol |
199 | 199 | */ |
200 | - protected function processDetails($data, Result &$result) |
|
200 | + protected function processDetails($data, Result & $result) |
|
201 | 201 | { |
202 | 202 | // Create a buffer |
203 | 203 | $buffer = new Buffer($data); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * @return void |
229 | 229 | * @throws \GameQ\Exception\Protocol |
230 | 230 | */ |
231 | - protected function processChannels($data, Result &$result) |
|
231 | + protected function processChannels($data, Result & $result) |
|
232 | 232 | { |
233 | 233 | // Create a buffer |
234 | 234 | $buffer = new Buffer($data); |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | * @return void |
262 | 262 | * @throws \GameQ\Exception\Protocol |
263 | 263 | */ |
264 | - protected function processPlayers($data, Result &$result) |
|
264 | + protected function processPlayers($data, Result & $result) |
|
265 | 265 | { |
266 | 266 | // Create a buffer |
267 | 267 | $buffer = new Buffer($data); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | // Find the server on this list by iterating over the entire list. |
155 | 155 | foreach ($json->GameSessions as $serverEntry) { |
156 | 156 | // Server information passed matches an entry on this list |
157 | - if ($serverEntry->Address === $this->realIp && (int)$serverEntry->Port === $this->realPortQuery) { |
|
157 | + if ($serverEntry->Address === $this->realIp && (int) $serverEntry->Port === $this->realPortQuery) { |
|
158 | 158 | $server = $serverEntry; |
159 | 159 | break; |
160 | 160 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | unset($matches, $serverEntry, $json); |
165 | 165 | |
166 | 166 | // Ensure the provided Server has been found in the list provided by the "Metaserver" |
167 | - if (! $server) { |
|
167 | + if (!$server) { |
|
168 | 168 | throw new Exception(sprintf( |
169 | 169 | '%s Unable to find the server "%s:%d" in the Stationeer Metaservers server list', |
170 | 170 | __METHOD__, |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $result->add('version', $server->Version); |
183 | 183 | $result->add('map', $server->MapName); |
184 | 184 | $result->add('uptime', $server->UpTime); |
185 | - $result->add('password', (int)$server->Password); |
|
185 | + $result->add('password', (int) $server->Password); |
|
186 | 186 | $result->add('numplayers', $server->Players); |
187 | 187 | $result->add('maxplayers', $server->MaxPlayers); |
188 | 188 | $result->add('type', $server->Type); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @param \GameQ\Result $result |
149 | 149 | * @throws \GameQ\Exception\Protocol |
150 | 150 | */ |
151 | - protected function processKeyValuePairs(Buffer &$buffer, Result &$result) |
|
151 | + protected function processKeyValuePairs(Buffer & $buffer, Result & $result) |
|
152 | 152 | { |
153 | 153 | // Key / value pairs |
154 | 154 | while ($buffer->getLength()) { |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * @param \GameQ\Result $result |
177 | 177 | * @throws \GameQ\Exception\Protocol |
178 | 178 | */ |
179 | - protected function processPlayersAndTeams(Buffer &$buffer, Result &$result) |
|
179 | + protected function processPlayersAndTeams(Buffer & $buffer, Result & $result) |
|
180 | 180 | { |
181 | 181 | // Players and team info |
182 | 182 | while ($buffer->getLength()) { |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @param \GameQ\Result $result |
246 | 246 | * @return void |
247 | 247 | */ |
248 | - protected function processDetails($data, Result &$result) |
|
248 | + protected function processDetails($data, Result & $result) |
|
249 | 249 | { |
250 | 250 | // Offload the parsing for these values |
251 | 251 | $properties = $this->processProperties($data); |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | * @param \GameQ\Result $result |
275 | 275 | * @return void |
276 | 276 | */ |
277 | - protected function processChannels($data, Result &$result) |
|
277 | + protected function processChannels($data, Result & $result) |
|
278 | 278 | { |
279 | 279 | // We need to split the data at the pipe |
280 | 280 | $channels = explode('|', $data); |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @param \GameQ\Result $result |
301 | 301 | * @return void |
302 | 302 | */ |
303 | - protected function processPlayers($data, Result &$result) |
|
303 | + protected function processPlayers($data, Result & $result) |
|
304 | 304 | { |
305 | 305 | // We need to split the data at the pipe |
306 | 306 | $players = explode('|', $data); |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * @return void |
237 | 237 | * @throws \GameQ\Exception\Protocol |
238 | 238 | */ |
239 | - protected function processDetails(Buffer &$buffer, Result &$result) |
|
239 | + protected function processDetails(Buffer & $buffer, Result & $result) |
|
240 | 240 | { |
241 | 241 | // We go until we hit an empty key |
242 | 242 | while ($buffer->getLength()) { |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | * @param \GameQ\Buffer $buffer |
255 | 255 | * @param \GameQ\Result $result |
256 | 256 | */ |
257 | - protected function processPlayersAndTeams(Buffer &$buffer, Result &$result) |
|
257 | + protected function processPlayersAndTeams(Buffer & $buffer, Result & $result) |
|
258 | 258 | { |
259 | 259 | /* |
260 | 260 | * Explode the data into groups. First is player, next is team (item_t) |