@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | |
| 363 | 363 | $request = new Request('dedimania.OpenSession', [$params]); |
| 364 | 364 | |
| 365 | - $this->sendRequest($request, function ($response) { |
|
| 365 | + $this->sendRequest($request, function($response) { |
|
| 366 | 366 | $this->sessionId = $response['SessionId']; |
| 367 | 367 | $this->getRecords(); |
| 368 | 368 | $this->connectAllPlayers(); |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | |
| 405 | 405 | $request = new Request('dedimania.GetChallengeRecords', $params); |
| 406 | 406 | |
| 407 | - $this->sendRequest($request, function ($response) { |
|
| 407 | + $this->sendRequest($request, function($response) { |
|
| 408 | 408 | |
| 409 | 409 | $this->dedimaniaService->setServerMaxRank($response['ServerMaxRank']); |
| 410 | 410 | /** @var DedimaniaRecord[] $recs */ |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | ]; |
| 449 | 449 | $request = new Request('dedimania.UpdateServerPlayers', $params); |
| 450 | 450 | |
| 451 | - $this->sendRequest($request, function ($response) { |
|
| 451 | + $this->sendRequest($request, function($response) { |
|
| 452 | 452 | // do nothing |
| 453 | 453 | }); |
| 454 | 454 | |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | ]; |
| 469 | 469 | |
| 470 | 470 | $request = new Request('dedimania.PlayerConnect', $params); |
| 471 | - $this->sendRequest($request, function ($response) use ($player) { |
|
| 471 | + $this->sendRequest($request, function($response) use ($player) { |
|
| 472 | 472 | $dediplayer = DedimaniaPlayer::fromArray($response); |
| 473 | 473 | |
| 474 | 474 | if ($dediplayer->banned) { |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | ]; |
| 498 | 498 | |
| 499 | 499 | $request = new Request('dedimania.PlayerConnect', $params); |
| 500 | - $this->sendRequest($request, function ($response) use ($player) { |
|
| 500 | + $this->sendRequest($request, function($response) use ($player) { |
|
| 501 | 501 | $this->dedimaniaService->disconnectPlayer($player->getLogin()); |
| 502 | 502 | }); |
| 503 | 503 | } |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | return; |
| 529 | 529 | } |
| 530 | 530 | |
| 531 | - $this->sendRequest($request, function ($response) { |
|
| 531 | + $this->sendRequest($request, function($response) { |
|
| 532 | 532 | |
| 533 | 533 | if (array_key_exists("Login", $response)) { |
| 534 | 534 | $response = [0 => $response]; |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | $that = $this; |
| 551 | - $this->getScores->get(function ($scores) use ($that) { |
|
| 551 | + $this->getScores->get(function($scores) use ($that) { |
|
| 552 | 552 | if (count($scores['players']) > 0 && isset($scores['players'][0]['login'])) { |
| 553 | 553 | |
| 554 | 554 | $player = new Player(); |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | |
| 580 | 580 | $request = new Request("dedimania.SetChallengeTimes", $params); |
| 581 | 581 | |
| 582 | - $that->sendRequest($request, function ($response) { |
|
| 582 | + $that->sendRequest($request, function($response) { |
|
| 583 | 583 | $this->console->writeln('Dedimania: $0f0records saved.'); |
| 584 | 584 | }); |
| 585 | 585 | } catch (\Exception $e) { |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | public function getXml() |
| 72 | 72 | { |
| 73 | - return '<base64>' . base64_encode($this->data) . '</base64>'; |
|
| 73 | + return '<base64>'.base64_encode($this->data).'</base64>'; |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
@@ -146,32 +146,32 @@ discard block |
||
| 146 | 146 | // Return XML for this value |
| 147 | 147 | switch ($this->type) { |
| 148 | 148 | case 'boolean': |
| 149 | - return '<boolean>' . ($this->data ? '1' : '0') . '</boolean>'; |
|
| 149 | + return '<boolean>'.($this->data ? '1' : '0').'</boolean>'; |
|
| 150 | 150 | break; |
| 151 | 151 | case 'int': |
| 152 | - return '<int>' . $this->data . '</int>'; |
|
| 152 | + return '<int>'.$this->data.'</int>'; |
|
| 153 | 153 | break; |
| 154 | 154 | case 'double': |
| 155 | - return '<double>' . $this->data . '</double>'; |
|
| 155 | + return '<double>'.$this->data.'</double>'; |
|
| 156 | 156 | break; |
| 157 | 157 | case 'string': |
| 158 | - return '<string>' . htmlspecialchars($this->data) . '</string>'; |
|
| 158 | + return '<string>'.htmlspecialchars($this->data).'</string>'; |
|
| 159 | 159 | break; |
| 160 | 160 | case 'array': |
| 161 | 161 | $xml = ''; |
| 162 | 162 | foreach ($this->data as $item) { |
| 163 | - $xml .= '<value>' . $item->getXml() . '</value>'; |
|
| 163 | + $xml .= '<value>'.$item->getXml().'</value>'; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - return '<array><data>' . $xml . '</data></array>'; |
|
| 166 | + return '<array><data>'.$xml.'</data></array>'; |
|
| 167 | 167 | break; |
| 168 | 168 | case 'struct': |
| 169 | 169 | $xml = ''; |
| 170 | 170 | foreach ($this->data as $name => $value) { |
| 171 | - $xml .= '<member><name>' . $name . '</name><value>' . $value->getXml() . '</value></member>'; |
|
| 171 | + $xml .= '<member><name>'.$name.'</name><value>'.$value->getXml().'</value></member>'; |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - return '<struct>' . $xml . '</struct>'; |
|
| 174 | + return '<struct>'.$xml.'</struct>'; |
|
| 175 | 175 | break; |
| 176 | 176 | case 'date': |
| 177 | 177 | case 'base64': |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | { |
| 187 | 187 | $expected = 0; |
| 188 | 188 | foreach ($array as $key => $value) { |
| 189 | - if ((string)$key != (string)$expected) { |
|
| 189 | + if ((string) $key != (string) $expected) { |
|
| 190 | 190 | return true; |
| 191 | 191 | } |
| 192 | 192 | $expected++; |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | public function select(&$read, &$write, &$except, $tv_sec, $tv_usec = 0) |
| 208 | 208 | { |
| 209 | - $timeout = (int)($tv_sec * 1000000 + $tv_usec); |
|
| 209 | + $timeout = (int) ($tv_sec * 1000000 + $tv_usec); |
|
| 210 | 210 | |
| 211 | 211 | if ($read == null) { |
| 212 | 212 | $read = array(); |
@@ -232,11 +232,11 @@ discard block |
||
| 232 | 232 | return 0; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - $utime = (int)(microtime(true) * 1000000); |
|
| 235 | + $utime = (int) (microtime(true) * 1000000); |
|
| 236 | 236 | $nb = @stream_select($read, $write, $except, $tv_sec, $tv_usec); |
| 237 | 237 | if ($nb === false) { |
| 238 | 238 | // in case stream_select "forgot" to wait, sleep the remaining asked timeout... |
| 239 | - $dtime = (int)(microtime(true) * 1000000) - $utime; |
|
| 239 | + $dtime = (int) (microtime(true) * 1000000) - $utime; |
|
| 240 | 240 | $timeout -= $dtime; |
| 241 | 241 | if ($timeout > 1000) { |
| 242 | 242 | usleep($timeout); |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | } |
| 804 | 804 | } // else just do a send on the current |
| 805 | 805 | elseif (isset($this->_spool[0]['State']) && $this->_spool[0]['State'] == 'OPEN') { |
| 806 | - @stream_set_timeout($this->_socket, 0, 2000); // timeout 2 ms |
|
| 806 | + @stream_set_timeout($this->_socket, 0, 2000); // timeout 2 ms |
|
| 807 | 807 | $this->_send($waittimeout); |
| 808 | 808 | } |
| 809 | 809 | } |
@@ -1032,7 +1032,7 @@ discard block |
||
| 1032 | 1032 | // reply is complete :) |
| 1033 | 1033 | if ($state === true) { |
| 1034 | 1034 | $this->_bad_timeout = 0; // reset error timeout |
| 1035 | - $time = microtime(true); // @todo see if this is needed ? |
|
| 1035 | + $time = microtime(true); // @todo see if this is needed ? |
|
| 1036 | 1036 | $this->_spool[0]['Times']['receive'][1] = $time - $this->_spool[0]['Times']['receive'][0]; |
| 1037 | 1037 | $this->_spool[0]['State'] = 'DONE'; |
| 1038 | 1038 | |