@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public function register() |
| 23 | 23 | { |
| 24 | - $this->getContainer()->share('Monolog\Logger', function () { |
|
| 24 | + $this->getContainer()->share('Monolog\Logger', function() { |
|
| 25 | 25 | $log = new Logger('app'); |
| 26 | 26 | |
| 27 | 27 | $config = $this->getContainer()->get('config'); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $log->pushHandler( |
| 42 | - new StreamHandler(__DIR__ . '/../../logs/app.log', Logger::DEBUG) |
|
| 42 | + new StreamHandler(__DIR__.'/../../logs/app.log', Logger::DEBUG) |
|
| 43 | 43 | ); |
| 44 | 44 | |
| 45 | 45 | return $log; |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | public function register() |
| 21 | 21 | { |
| 22 | - $this->getContainer()->add('GuzzleHttp\Client', function () { |
|
| 22 | + $this->getContainer()->add('GuzzleHttp\Client', function() { |
|
| 23 | 23 | return new Client([ |
| 24 | 24 | 'timeout' => 10.0 |
| 25 | 25 | ]); |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | $missing = 0; |
| 41 | 41 | $max = $result->ResultID; |
| 42 | 42 | |
| 43 | - while($count < $max) { |
|
| 43 | + while ($count < $max) { |
|
| 44 | 44 | $count++; |
| 45 | 45 | |
| 46 | 46 | $per = round(($count / $max) * 100, 2); |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | function convert($size) { |
| 4 | - $unit=array('B','KB','MB','GB','TB','PB'); |
|
| 5 | - return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i]; |
|
| 4 | + $unit = array('B', 'KB', 'MB', 'GB', 'TB', 'PB'); |
|
| 5 | + return @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2).' '.$unit[$i]; |
|
| 6 | 6 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // Now return the character the outfit injected |
| 82 | - if (! empty($character['data']['outfit'])) { |
|
| 82 | + if (!empty($character['data']['outfit'])) { |
|
| 83 | 83 | try { |
| 84 | 84 | $outfit = $this->getOutfit($character['data']['outfit']); |
| 85 | 85 | } catch (CensusErrorException $e) { |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | // First, check if we have the character in Redis |
| 139 | 139 | $redisCheck = $this->checkRedis('cache', 'character', $id); |
| 140 | 140 | |
| 141 | - if (! empty($redisCheck)) { |
|
| 141 | + if (!empty($redisCheck)) { |
|
| 142 | 142 | return $redisCheck; |
| 143 | 143 | } |
| 144 | 144 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | // First, check if we have the outfit in Redis |
| 188 | 188 | $redisCheck = $this->checkRedis('cache', 'outfit', $id); |
| 189 | 189 | |
| 190 | - if (! empty($redisCheck)) { |
|
| 190 | + if (!empty($redisCheck)) { |
|
| 191 | 191 | return $redisCheck; |
| 192 | 192 | } |
| 193 | 193 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | ]; |
| 245 | 245 | |
| 246 | 246 | // Loop through each environment and get the first result |
| 247 | - foreach($environments as $env) { |
|
| 247 | + foreach ($environments as $env) { |
|
| 248 | 248 | $url = "https://census.daybreakgames.com/s:{$config['census_service_id']}/get/{$env}/{$endpoint}"; |
| 249 | 249 | |
| 250 | 250 | $req = $guzzle->request('GET', $url); |
@@ -83,7 +83,7 @@ |
||
| 83 | 83 | |
| 84 | 84 | $data = []; |
| 85 | 85 | |
| 86 | - foreach($config['servers'] as $server) { |
|
| 86 | + foreach ($config['servers'] as $server) { |
|
| 87 | 87 | $key = "ps2alerts:api:leaderboards:status:{$server}"; |
| 88 | 88 | |
| 89 | 89 | if ($redis->exists($key)) { |
@@ -22,6 +22,6 @@ |
||
| 22 | 22 | public function __construct( |
| 23 | 23 | Manager $fractal |
| 24 | 24 | ) { |
| 25 | - $this->fractal = $fractal; |
|
| 25 | + $this->fractal = $fractal; |
|
| 26 | 26 | } |
| 27 | 27 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | if ($this->parsePlayerName($args['term'], $response)) { |
| 53 | 53 | $players = $this->searchForPlayer($args['term']); |
| 54 | 54 | |
| 55 | - if (! empty($players)) { |
|
| 55 | + if (!empty($players)) { |
|
| 56 | 56 | return $this->respond( |
| 57 | 57 | 'collection', |
| 58 | 58 | $players, |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | if ($this->parseOutfitName($name, $response)) { |
| 82 | 82 | $outfits = $this->searchForOutfit($name); |
| 83 | 83 | |
| 84 | - if (! empty($outfits)) { |
|
| 84 | + if (!empty($outfits)) { |
|
| 85 | 85 | return $this->respond( |
| 86 | 86 | 'collection', |
| 87 | 87 | $outfits, |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | return $this->errorWrongArgs('Player ID cannot be longer than 19 characters.'); |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - if (! is_numeric($id)) { |
|
| 202 | + if (!is_numeric($id)) { |
|
| 203 | 203 | return $this->errorWrongArgs('Player ID must be numeric.'); |
| 204 | 204 | } |
| 205 | 205 | |
@@ -49,23 +49,23 @@ discard block |
||
| 49 | 49 | $data = $this->checkRedis('api', 'combatTotals', "{$server}-data"); |
| 50 | 50 | $dataArchive = $this->checkRedis('api', 'combatTotals', "{$server}-dataArchive"); |
| 51 | 51 | |
| 52 | - if (! $data || ! $dataArchive) { |
|
| 52 | + if (!$data || !$dataArchive) { |
|
| 53 | 53 | $sums = []; |
| 54 | 54 | foreach ($metrics as $metric) { |
| 55 | 55 | foreach ($factions as $faction) { |
| 56 | - $dbMetric = $metric . strtoupper($faction); // e.g. killsVS |
|
| 57 | - $dataMetric = $metric . strtoupper($faction); // e.g. killsVS |
|
| 56 | + $dbMetric = $metric.strtoupper($faction); // e.g. killsVS |
|
| 57 | + $dataMetric = $metric.strtoupper($faction); // e.g. killsVS |
|
| 58 | 58 | |
| 59 | 59 | // Handle teamkills inconsistency |
| 60 | 60 | if ($metric === 'teamkills') { |
| 61 | - $dbMetric = 'teamKills' . strtoupper($faction); |
|
| 61 | + $dbMetric = 'teamKills'.strtoupper($faction); |
|
| 62 | 62 | } |
| 63 | 63 | $sums[] = "SUM(factions.{$dbMetric}) AS $dataMetric"; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | // Totals |
| 67 | - $dbMetric = 'total' . ucfirst($metric); // e.g. killsVS |
|
| 68 | - $dataMetric = 'total' . ucfirst($metric); // e.g. killsVS |
|
| 67 | + $dbMetric = 'total'.ucfirst($metric); // e.g. killsVS |
|
| 68 | + $dataMetric = 'total'.ucfirst($metric); // e.g. killsVS |
|
| 69 | 69 | |
| 70 | 70 | // Handle teamkills inconsistency |
| 71 | 71 | if ($metric === 'teamkills') { |
@@ -100,12 +100,12 @@ discard block |
||
| 100 | 100 | // Merge the two arrays together |
| 101 | 101 | foreach ($metrics as $metric) { |
| 102 | 102 | // Tot up totals |
| 103 | - $dbMetric = 'total' . ucfirst($metric); |
|
| 103 | + $dbMetric = 'total'.ucfirst($metric); |
|
| 104 | 104 | $mergedArray['totals'][$metric] = (int) $data[$dbMetric] + (int) $dataArchive[$dbMetric]; |
| 105 | 105 | $results['all']['totals'][$metric] += $mergedArray['totals'][$metric]; |
| 106 | 106 | |
| 107 | 107 | foreach ($factions as $faction) { |
| 108 | - $dbMetric = $metric . strtoupper($faction); |
|
| 108 | + $dbMetric = $metric.strtoupper($faction); |
|
| 109 | 109 | $mergedArray[$metric][$faction] = (int) $data[$dbMetric] + (int) $dataArchive[$dbMetric]; |
| 110 | 110 | $results['all'][$metric][$faction] += $mergedArray[$metric][$faction]; |
| 111 | 111 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $dataArchive = $this->checkRedis('api', 'classCombat', "{$server}-dataArchive", 'object'); |
| 149 | 149 | |
| 150 | 150 | // If data needs a pull |
| 151 | - if (! $data || ! $dataArchive) { |
|
| 151 | + if (!$data || !$dataArchive) { |
|
| 152 | 152 | $query = $this->combatRepository->newQuery('single', true); |
| 153 | 153 | $query->cols([ |
| 154 | 154 | 'classID', |
@@ -181,8 +181,8 @@ discard block |
||
| 181 | 181 | // Typecase into ints and increase totals |
| 182 | 182 | $metrics = ['kills', 'deaths', 'teamkills', 'suicides']; |
| 183 | 183 | foreach ($data as $row) { |
| 184 | - $row->classID = (int) $row->classID; |
|
| 185 | - $row->server = (int) $row->server; |
|
| 184 | + $row->classID = (int) $row->classID; |
|
| 185 | + $row->server = (int) $row->server; |
|
| 186 | 186 | $classGroup = $this->findClassGrouping($row->classID); |
| 187 | 187 | $faction = $this->findClassFaction($row->classID); |
| 188 | 188 | |
@@ -201,8 +201,8 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | foreach ($dataArchive as $row) { |
| 204 | - $row->classID = (int) $row->classID; |
|
| 205 | - $row->server = (int) $row->server; |
|
| 204 | + $row->classID = (int) $row->classID; |
|
| 205 | + $row->server = (int) $row->server; |
|
| 206 | 206 | |
| 207 | 207 | foreach ($metrics as $metric) { |
| 208 | 208 | $row->$metric = (int) $row->$metric; |