@@ -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 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $alert = $this->alertRepo->readSingleById($id, 'primary', true); |
| 55 | 55 | |
| 56 | 56 | if (empty($force) && empty($id)) { |
| 57 | - $output->writeln("ALERT {$id} DOES NOT EXIST!"); |
|
| 57 | + $output->writeln("alert {$id} DOES NOT EXIST!"); |
|
| 58 | 58 | return false; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $this->deleteAlert($id); |
| 100 | 100 | |
| 101 | 101 | if ($this->verbose === 1) { |
| 102 | - $output->writeln("Alert {$id} successfully deleted!"); |
|
| 102 | + $output->writeln("alert {$id} successfully deleted!"); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | return true; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | /** |
| 116 | 116 | * Processes players for alert |
| 117 | 117 | * @param string $id Alert ID |
| 118 | - * @return void |
|
| 118 | + * @return integer |
|
| 119 | 119 | */ |
| 120 | 120 | protected function processPlayers($id) |
| 121 | 121 | { |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | /** |
| 150 | 150 | * Processes outfits for alert |
| 151 | 151 | * @param string $id Alert ID |
| 152 | - * @return void |
|
| 152 | + * @return integer |
|
| 153 | 153 | */ |
| 154 | 154 | protected function processOutfits($id) |
| 155 | 155 | { |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | /** |
| 182 | 182 | * Processes XPs for alert |
| 183 | 183 | * @param string $id Alert ID |
| 184 | - * @return void |
|
| 184 | + * @return integer |
|
| 185 | 185 | */ |
| 186 | 186 | protected function processXP($id) |
| 187 | 187 | { |
@@ -208,11 +208,11 @@ discard block |
||
| 208 | 208 | /** |
| 209 | 209 | * Executes the process based on inputs |
| 210 | 210 | * @param string $id Alert ID |
| 211 | - * @param array $cols Columns to look for |
|
| 211 | + * @param string[] $cols Columns to look for |
|
| 212 | 212 | * @param string $table Table to look for |
| 213 | 213 | * @param string $totalsTable Table total to update if applicable |
| 214 | 214 | * @param string $filter Column to filter on |
| 215 | - * @param array $fields Fields to summarize |
|
| 215 | + * @param string[] $fields Fields to summarize |
|
| 216 | 216 | * @param array $groupBy Fields to group by |
| 217 | 217 | * @return int |
| 218 | 218 | */ |
@@ -270,6 +270,9 @@ discard block |
||
| 270 | 270 | return $count; |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | + /** |
|
| 274 | + * @param string $id |
|
| 275 | + */ |
|
| 273 | 276 | protected function deleteAllFromTables(array $tables, $id, OutputInterface $output) |
| 274 | 277 | { |
| 275 | 278 | foreach ($tables as $table) { |
@@ -288,6 +291,9 @@ discard block |
||
| 288 | 291 | } |
| 289 | 292 | } |
| 290 | 293 | |
| 294 | + /** |
|
| 295 | + * @param string $id |
|
| 296 | + */ |
|
| 291 | 297 | protected function deleteAlert($id) |
| 292 | 298 | { |
| 293 | 299 | $delete = $this->auraFactory->newDelete(); |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | /** |
| 12 | 12 | * Construct |
| 13 | 13 | * |
| 14 | - */ |
|
| 14 | + */ |
|
| 15 | 15 | public function __construct() |
| 16 | 16 | { |
| 17 | 17 | |
@@ -1,12 +1,12 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include __DIR__ . '/../vendor/autoload.php'; |
|
| 3 | +include __DIR__.'/../vendor/autoload.php'; |
|
| 4 | 4 | |
| 5 | 5 | use League\Route\Http\Exception\NotFoundException; |
| 6 | 6 | |
| 7 | 7 | // ENV loading |
| 8 | 8 | josegonzalez\Dotenv\Loader::load([ |
| 9 | - 'filepath' => __DIR__ . '/../.env', |
|
| 9 | + 'filepath' => __DIR__.'/../.env', |
|
| 10 | 10 | 'toEnv' => true |
| 11 | 11 | ]); |
| 12 | 12 | |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | // Container |
| 24 | -$container = include __DIR__ . '/../src/container.php'; |
|
| 24 | +$container = include __DIR__.'/../src/container.php'; |
|
| 25 | 25 | |
| 26 | 26 | // Routes |
| 27 | -$router = include __DIR__ . '/../src/routes.php'; |
|
| 27 | +$router = include __DIR__.'/../src/routes.php'; |
|
| 28 | 28 | |
| 29 | 29 | // FIRE!!! |
| 30 | 30 | try { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | } catch (\Exception $e) { |
| 45 | 45 | $response = $container->get('Zend\Diactoros\Response'); |
| 46 | 46 | $response->getBody()->write( |
| 47 | - 'An error occured! ' . $e->getMessage() |
|
| 47 | + 'An error occured! '.$e->getMessage() |
|
| 48 | 48 | ); |
| 49 | 49 | |
| 50 | 50 | $logger = $container->get('Monolog\Logger'); |
@@ -9,15 +9,15 @@ |
||
| 9 | 9 | use Ps2alerts\Api\Command\TestCommand; |
| 10 | 10 | use Symfony\Component\Console\Application; |
| 11 | 11 | |
| 12 | -require __DIR__ . '/../vendor/autoload.php'; |
|
| 12 | +require __DIR__.'/../vendor/autoload.php'; |
|
| 13 | 13 | |
| 14 | 14 | // ENV loading |
| 15 | 15 | josegonzalez\Dotenv\Loader::load([ |
| 16 | - 'filepath' => __DIR__ . '/../.env', |
|
| 16 | + 'filepath' => __DIR__.'/../.env', |
|
| 17 | 17 | 'toEnv' => true |
| 18 | 18 | ]); |
| 19 | 19 | |
| 20 | -include __DIR__ . '/Command/CommandsCommon.php'; |
|
| 20 | +include __DIR__.'/Command/CommandsCommon.php'; |
|
| 21 | 21 | |
| 22 | 22 | $application = new Application(); |
| 23 | 23 | // List commands here |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | |
| 12 | 12 | protected function configure() |
| 13 | 13 | { |
| 14 | - $container = include __DIR__ . '/../container.php'; |
|
| 14 | + $container = include __DIR__.'/../container.php'; |
|
| 15 | 15 | |
| 16 | 16 | $this->container = $container; |
| 17 | 17 | $this->auraFactory = $container->get('Ps2alerts\Api\Factory\AuraFactory'); |
@@ -122,8 +122,8 @@ |
||
| 122 | 122 | * Execution of routine |
| 123 | 123 | * |
| 124 | 124 | * @param array $alert |
| 125 | - * @param array $tables |
|
| 126 | - * @param Symfony\Component\Console\Output\OutputInterface $output |
|
| 125 | + * @param string[] $tables |
|
| 126 | + * @param OutputInterface $output |
|
| 127 | 127 | * |
| 128 | 128 | * @return void |
| 129 | 129 | */ |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $alerts = $this->alertRepo->fireStatementAndReturn($query); |
| 74 | 74 | $count = count($alerts); |
| 75 | 75 | |
| 76 | - $output->writeln("Detected {$count} alerts to be archived"); |
|
| 76 | + $output->writeln("detected {$count} alerts to be archived"); |
|
| 77 | 77 | |
| 78 | 78 | if ($count > 0) { |
| 79 | 79 | $tables = [ |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | ['json' => $payload] |
| 116 | 116 | ); |
| 117 | 117 | |
| 118 | - $output->writeln("Archived {$records} records!"); |
|
| 118 | + $output->writeln("archived {$records} records!"); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $this->recordsArchived += $stm->rowCount(); |
| 184 | 184 | $records += $stm->rowCount(); |
| 185 | 185 | |
| 186 | - $output->writeln("Archived {$stm->rowCount()} from Alert #{$alert['ResultID']} - Table {$table}"); |
|
| 186 | + $output->writeln("archived {$stm->rowCount()} from Alert #{$alert['ResultID']} - Table {$table}"); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | $this->db->commit(); |
@@ -13,7 +13,6 @@ |
||
| 13 | 13 | use Ps2alerts\Api\Contract\RedisAwareInterface; |
| 14 | 14 | use Ps2alerts\Api\Contract\RedisAwareTrait; |
| 15 | 15 | use Ps2alerts\Api\Exception\InvalidArgumentException; |
| 16 | -use Psr\Http\Message\ServerRequestInterface; |
|
| 17 | 16 | use Psr\Http\Message\ResponseInterface; |
| 18 | 17 | |
| 19 | 18 | abstract class AbstractEndpointController implements |
@@ -437,7 +437,7 @@ |
||
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | if (!in_array($id, $filters)) { |
| 440 | - throw new InvalidArgumentException("Unrecognized {$mode}. Please check the IDs you sent."); |
|
| 440 | + throw new InvalidArgumentException("unrecognized {$mode}. Please check the IDs you sent."); |
|
| 441 | 441 | } |
| 442 | 442 | } |
| 443 | 443 | |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | $query->where('playerServer', $server); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - $query->orderBy([$metric . ' DESC']); |
|
| 80 | + $query->orderBy([$metric.' DESC']); |
|
| 81 | 81 | $query->limit($limit); |
| 82 | 82 | $query->offset($count); |
| 83 | 83 | |