Completed
Pull Request — master (#22)
by Matthew
03:51 queued 02:04
created
src/Command/DeleteMissingAlertsCommand.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use Ps2alerts\Api\Command\BaseCommand;
6 6
 use Ps2alerts\Api\Repository\AlertRepository;
7
-use Symfony\Component\Console\Input\InputArgument;
8 7
 use Symfony\Component\Console\Input\InputInterface;
9 8
 use Symfony\Component\Console\Output\OutputInterface;
10 9
 
Please login to merge, or discard this patch.
src/commands.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,15 +9,15 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Command/BaseCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
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');
Please login to merge, or discard this patch.
src/Command/ArchiveCommand.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -122,8 +122,8 @@
 block discarded – undo
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
      */
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
src/Command/DeleteAlertCommand.php 1 patch
Doc Comments   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
src/Controller/Endpoint/AbstractEndpointController.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,6 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -437,7 +437,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Command/LeaderboardOutfitsCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Command/LeaderboardPlayersCommand.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
                     $query->cols(['*']);
90 90
                     $query->from('ws_players_total');
91 91
                     if ($server != 0) {
92
-                         $query->where("playerServer = ?", $server);
92
+                            $query->where("playerServer = ?", $server);
93 93
                     }
94 94
                     $query->orderBy([$metric.' DESC']);
95 95
                     $query->limit($limit);
Please login to merge, or discard this patch.
src/Controller/Endpoint/Leaderboards/LeaderboardEndpointController.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     /**
29 29
      * Construct
30 30
      *
31
-     * @param League\Fractal\Manager $fractal
31
+     * @param Manager $fractal
32 32
      */
33 33
     public function __construct(
34 34
         Manager                $fractal,
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     /**
49 49
      * Get Player Leaderboard
50 50
      *
51
-     * @return \League\Fractal\Manager
51
+     * @return ResponseInterface
52 52
      */
53 53
     public function players()
54 54
     {
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     /**
138 138
      * Get Outfit Leaderboard
139 139
      *
140
-     * @return \League\Fractal\Manager
140
+     * @return ResponseInterface
141 141
      */
142 142
     public function outfits()
143 143
     {
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
     /**
209 209
      * Get Weapon Leaderboard
210 210
      *
211
-     * @return \League\Fractal\Manager
211
+     * @return ResponseInterface
212 212
      */
213 213
     public function weapons()
214 214
     {
Please login to merge, or discard this patch.
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -11,12 +11,9 @@
 block discarded – undo
11 11
 use Ps2alerts\Api\Repository\Metrics\OutfitTotalRepository;
12 12
 use Ps2alerts\Api\Repository\Metrics\PlayerTotalRepository;
13 13
 use Ps2alerts\Api\Repository\Metrics\WeaponTotalRepository;
14
-use Ps2alerts\Api\Transformer\Leaderboards\LeaderboardUpdatedTransformer;
15 14
 use Ps2alerts\Api\Transformer\Leaderboards\OutfitLeaderboardTransformer;
16 15
 use Ps2alerts\Api\Transformer\Leaderboards\PlayerLeaderboardTransformer;
17 16
 use Ps2alerts\Api\Transformer\Leaderboards\WeaponLeaderboardTransformer;
18
-use Psr\Http\Message\ResponseInterface;
19
-use Psr\Http\Message\ServerRequestInterface;
20 17
 
21 18
 class LeaderboardEndpointController extends AbstractEndpointController
22 19
 {
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
             }
85 85
         }
86 86
 
87
-        if (! isset($field)) {
87
+        if (!isset($field)) {
88 88
             return $this->errorWrongArgs('Field wasn\'t provided and is required.');
89 89
         }
90 90
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
         // Gets outfit details
115 115
         for ($i = 0; $i < $count; $i++) {
116
-            if (! empty($players[$i]['playerOutfit'])) {
116
+            if (!empty($players[$i]['playerOutfit'])) {
117 117
                 // Gets outfit details
118 118
                 try {
119 119
                     $outfit = $this->dataEndpoint->getOutfit($players[$i]['playerOutfit']);
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
             }
175 175
         }
176 176
 
177
-        if (! isset($field)) {
177
+        if (!isset($field)) {
178 178
             return $this->errorWrongArgs('Field wasn\'t provided and is required.');
179 179
         }
180 180
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
             }
235 235
         }
236 236
 
237
-        if (! isset($field)) {
237
+        if (!isset($field)) {
238 238
             return $this->errorWrongArgs('Field wasn\'t provided and is required.');
239 239
         }
240 240
 
@@ -276,19 +276,19 @@  discard block
 block discarded – undo
276 276
     public function validateRequestVars()
277 277
     {
278 278
         try {
279
-            if (! empty($_GET['field'])) {
279
+            if (!empty($_GET['field'])) {
280 280
                 $this->parseField($_GET['field']);
281 281
             }
282 282
 
283
-            if (! empty($_GET['server'])) {
283
+            if (!empty($_GET['server'])) {
284 284
                 $this->parseServer($_GET['server']);
285 285
             }
286 286
 
287
-            if (! empty($_GET['limit'])) {
287
+            if (!empty($_GET['limit'])) {
288 288
                 $this->parseOffset($_GET['limit']);
289 289
             }
290 290
 
291
-            if (! empty($_GET['offset'])) {
291
+            if (!empty($_GET['offset'])) {
292 292
                 $this->parseOffset($_GET['offset']);
293 293
             }
294 294
         } catch (InvalidArgumentException $e) {
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
             'captures'
315 315
         ];
316 316
 
317
-        if (! empty($field) && in_array($field, $validFields)) {
317
+        if (!empty($field) && in_array($field, $validFields)) {
318 318
             return $field;
319 319
         }
320 320
 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
             unset($validServers[$key]);
336 336
         }
337 337
 
338
-        if (! empty($server) && in_array($server, $validServers)) {
338
+        if (!empty($server) && in_array($server, $validServers)) {
339 339
             return $server;
340 340
         }
341 341
 
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
      */
350 350
     public function parseLimit($limit)
351 351
     {
352
-        if (! isset($limit) && ! is_numeric($limit)) {
352
+        if (!isset($limit) && !is_numeric($limit)) {
353 353
             throw new InvalidArgumentException("Limit needs to be in numerical format.");
354 354
         }
355 355
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
      */
362 362
     public function parseOffset($offset)
363 363
     {
364
-        if (! isset($offset) && ! is_numeric($offset)) {
364
+        if (!isset($offset) && !is_numeric($offset)) {
365 365
             throw new InvalidArgumentException("Offset needs to be in numerical format.");
366 366
         }
367 367
 
Please login to merge, or discard this patch.