@@ -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)) { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - if (! isset($field)) { |
|
| 86 | + if (!isset($field)) { |
|
| 87 | 87 | return $this->errorWrongArgs('Field wasn\'t provided and is required.'); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | // Gets outfit details |
| 114 | 114 | for ($i = 0; $i < $count; $i++) { |
| 115 | - if (! empty($players[$i]['playerOutfit'])) { |
|
| 115 | + if (!empty($players[$i]['playerOutfit'])) { |
|
| 116 | 116 | // Gets outfit details |
| 117 | 117 | try { |
| 118 | 118 | $outfit = $this->dataEndpoint->getOutfit($players[$i]['playerOutfit']); |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - if (! isset($field)) { |
|
| 179 | + if (!isset($field)) { |
|
| 180 | 180 | return $this->errorWrongArgs('Field wasn\'t provided and is required.'); |
| 181 | 181 | } |
| 182 | 182 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | } |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - if (! isset($field)) { |
|
| 242 | + if (!isset($field)) { |
|
| 243 | 243 | return $this->errorWrongArgs('Field wasn\'t provided and is required.'); |
| 244 | 244 | } |
| 245 | 245 | |
@@ -282,19 +282,19 @@ discard block |
||
| 282 | 282 | public function validateRequestVars($request) |
| 283 | 283 | { |
| 284 | 284 | try { |
| 285 | - if (! empty($_GET['field'])) { |
|
| 285 | + if (!empty($_GET['field'])) { |
|
| 286 | 286 | $this->parseField($_GET['field']); |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | - if (! empty($_GET['server'])) { |
|
| 289 | + if (!empty($_GET['server'])) { |
|
| 290 | 290 | $this->parseServer($_GET['server']); |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - if (! empty($_GET['limit'])) { |
|
| 293 | + if (!empty($_GET['limit'])) { |
|
| 294 | 294 | $this->parseOffset($_GET['limit']); |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | - if (! empty($_GET['offset'])) { |
|
| 297 | + if (!empty($_GET['offset'])) { |
|
| 298 | 298 | $this->parseOffset($_GET['offset']); |
| 299 | 299 | } |
| 300 | 300 | } catch (InvalidArgumentException $e) { |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | 'captures' |
| 321 | 321 | ]; |
| 322 | 322 | |
| 323 | - if (! empty($field) && in_array($field, $validFields)) { |
|
| 323 | + if (!empty($field) && in_array($field, $validFields)) { |
|
| 324 | 324 | return $field; |
| 325 | 325 | } |
| 326 | 326 | |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | unset($validServers[$key]); |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - if (! empty($server) && in_array($server, $validServers)) { |
|
| 344 | + if (!empty($server) && in_array($server, $validServers)) { |
|
| 345 | 345 | return $server; |
| 346 | 346 | } |
| 347 | 347 | |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | */ |
| 356 | 356 | public function parseLimit($limit) |
| 357 | 357 | { |
| 358 | - if (! isset($limit) && ! is_numeric($limit)) { |
|
| 358 | + if (!isset($limit) && !is_numeric($limit)) { |
|
| 359 | 359 | throw new InvalidArgumentException("Limit needs to be in numerical format."); |
| 360 | 360 | } |
| 361 | 361 | |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | */ |
| 368 | 368 | public function parseOffset($offset) |
| 369 | 369 | { |
| 370 | - if (! isset($offset) && ! is_numeric($offset)) { |
|
| 370 | + if (!isset($offset) && !is_numeric($offset)) { |
|
| 371 | 371 | throw new InvalidArgumentException("Offset needs to be in numerical format."); |
| 372 | 372 | } |
| 373 | 373 | |
@@ -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 | |