Completed
Push — master ( e6da3a...2e3b4d )
by Matthew
02:31
created
src/Controller/Metrics/ClassMetricsEndpoint.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     /**
14 14
      * Returns a single entry
15 15
      *
16
-     * @param  Symfony\Component\HttpFoundation\Request $request
16
+     * @param  Request $request
17 17
      * @param  array   $args
18 18
      *
19 19
      * @return \League\Route\Http\JsonResponse
Please login to merge, or discard this patch.
src/Controller/Alerts/AlertEndpointController.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 League\Route\Http\JsonResponse as Response;
6 6
 use Ps2alerts\Api\Controller\EndpointBaseController;
7
-use Ps2alerts\Api\QueryObjects\QueryObject;
8 7
 use Ps2alerts\Api\Loader\ResultLoader;
9 8
 use Symfony\Component\HttpFoundation\Request;
10 9
 
Please login to merge, or discard this patch.
src/Controller/Statistics/OutfitTotalsStatisticsEndpoint.php 1 patch
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
     /**
13 13
      * Construct
14 14
      *
15
-     * @param \Ps2alerts\Api\Loader\Metrics\OutfitTotalsStatisticsLoader $loader
15
+     * @param OutfitTotalsStatisticsLoader $loader
16 16
      */
17 17
     public function __construct(OutfitTotalsStatisticsLoader $loader)
18 18
     {
@@ -23,7 +23,6 @@  discard block
 block discarded – undo
23 23
      * Returns top X entries
24 24
      *
25 25
      * @param  \Symfony\Component\HttpFoundation\Request $request
26
-     * @param  array                                     $args
27 26
      *
28 27
      * @return \League\Route\Http\JsonResponse
29 28
      */
Please login to merge, or discard this patch.
src/Controller/Statistics/PlayerStatisticsEndpoint.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
     /**
13 13
      * Construct
14 14
      *
15
-     * @param \Ps2alerts\Api\Loader\Metrics\PlayerStatisticsLoader $loader
15
+     * @param PlayerStatisticsLoader $loader
16 16
      */
17 17
     public function __construct(PlayerStatisticsLoader $loader)
18 18
     {
Please login to merge, or discard this patch.
src/Loader/Statistics/OutfitTotalsStatisticsLoader.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
     /**
17 17
      * Construct
18 18
      *
19
-     * @param \Ps2alerts\Api\Repository\Metrics\OutfitTotalsRepository $repository
19
+     * @param OutfitTotalsRepository $repository
20 20
      */
21 21
     public function __construct(OutfitTotalsRepository $repository)
22 22
     {
Please login to merge, or discard this 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 League\Route\Http\JsonResponse as Response;
6 6
 use Ps2alerts\Api\Controller\EndpointBaseController;
7
-use Ps2alerts\Api\QueryObjects\QueryObject;
8 7
 use Ps2alerts\Api\Loader\ResultLoader;
9 8
 use Symfony\Component\HttpFoundation\Request;
10 9
 
Please login to merge, or discard this patch.
src/Loader/Statistics/PlayerStatisticsLoader.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -91,6 +91,9 @@
 block discarded – undo
91 91
         );
92 92
     }
93 93
 
94
+    /**
95
+     * @param string $field
96
+     */
94 97
     public function validatePostVars($field, $value)
95 98
     {
96 99
         if ($field === 'metric' && ! empty($value)) {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
         $queryObject = new QueryObject;
33 33
 
34 34
         // Build based on metric alone (order by playerKills for example)
35
-        if (! empty($post['metric'] && empty($post['value']))
35
+        if (!empty($post['metric'] && empty($post['value']))
36 36
             && $this->validatePostVars('metric', $post['metric']) === true
37 37
         ) {
38
-            $direction = (! empty($post['direction']) ? $post['direction'] : 'desc');
38
+            $direction = (!empty($post['direction']) ? $post['direction'] : 'desc');
39 39
 
40 40
             $queryObject->setOrderBy($post['metric']);
41 41
             $queryObject->setOrderByDirection($direction);
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
         }
45 45
 
46 46
         // Build based on metric and a value (such as order by playerKills by server)
47
-        if (! empty($post['value'])
48
-            && ! empty($post['metric'])
47
+        if (!empty($post['value'])
48
+            && !empty($post['metric'])
49 49
             && $this->validatePostVars('metric', $post['metric']) === true
50 50
         ) {
51
-            $op = (! empty($post['operator']) ? $post['operator'] : '=');
51
+            $op = (!empty($post['operator']) ? $post['operator'] : '=');
52 52
 
53 53
             $queryObject->addWhere([
54 54
                 'col' => $post['metric'],
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
                 'value' => $post['value']
57 57
             ]);
58 58
 
59
-            $direction = (! empty($post['direction']) ? $post['direction'] : 'desc');
59
+            $direction = (!empty($post['direction']) ? $post['direction'] : 'desc');
60 60
 
61 61
             $queryObject->setOrderBy($post['metric']);
62 62
             $queryObject->setOrderByDirection($direction);
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             $redisKey .= ":{$post['metric']}{$op}{$post['value']}-{$direction}";
65 65
         }
66 66
 
67
-        if (! empty($post['limit'])) {
67
+        if (!empty($post['limit'])) {
68 68
             $post['limit'] = intval($post['limit']);
69 69
 
70 70
             // Hard encode a 50 limit
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
     public function validatePostVars($field, $value)
95 95
     {
96
-        if ($field === 'metric' && ! empty($value)) {
96
+        if ($field === 'metric' && !empty($value)) {
97 97
             switch ($value) {
98 98
                 case 'playerKills':
99 99
                 case 'playerDeaths':
Please login to merge, or discard this patch.
src/QueryObjects/QueryObject.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      * in the array and added to.
50 50
      * e.g. $queryObject->addSelect('COUNT(ResultID) AS COUNT');
51 51
      *
52
-     * @param string $string
52
+     * @param string $array
53 53
      */
54 54
     public function addSelect($array)
55 55
     {
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     /**
172 172
      * Allows setting of workaround flags
173 173
      *
174
-     * @param array|string $flags
174
+     * @param string $flags
175 175
      */
176 176
     public function setFlags($flags)
177 177
     {
Please login to merge, or discard this patch.
src/Repository/AbstractEndpointRepository.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
         $query = $this->newQuery();
67 67
 
68 68
         // Setup select statements
69
-        if (! empty($queryObject->getSelects())) {
69
+        if (!empty($queryObject->getSelects())) {
70 70
             $query->cols($queryObject->getSelects());
71 71
         } else {
72 72
             $query->cols(['*']);
73 73
         }
74 74
 
75 75
         // Workarounds :-/
76
-        if (! empty($queryObject->getFlags())) {
76
+        if (!empty($queryObject->getFlags())) {
77 77
             if ($queryObject->getFlags() === 'outfitIDs') {
78 78
                 // Prevent the VS, NC and TR "no outfit" workaround
79 79
                 $queryObject->addWhere([
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         }
86 86
 
87 87
         // Setup where statements
88
-        if (! empty($queryObject->getWheres())) {
88
+        if (!empty($queryObject->getWheres())) {
89 89
             foreach ($queryObject->getWheres() as $where) {
90 90
                 $col = $where['col'];
91 91
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         }
105 105
 
106 106
         // Set up order statement
107
-        if (! empty($queryObject->getOrderBy())) {
107
+        if (!empty($queryObject->getOrderBy())) {
108 108
             $orderBy = $queryObject->getOrderBy();
109 109
             if ($orderBy === 'primary') {
110 110
                 $orderBy = $this->getPrimaryKey();
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
             ]);
119 119
         }
120 120
 
121
-        if (! empty($queryObject->getLimit())) {
121
+        if (!empty($queryObject->getLimit())) {
122 122
             $query->limit($queryObject->getLimit());
123 123
         }
124 124
 
Please login to merge, or discard this patch.
src/Loader/Statistics/AlertStatisticsLoader.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             'value' => '1'
55 55
         ]);
56 56
 
57
-        if (! empty($post['ResultServer'])) {
57
+        if (!empty($post['ResultServer'])) {
58 58
             if ($this->inputValidator->validatePostVars(
59 59
                 'ResultServer',
60 60
                 $post['ResultServer']
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
             }
68 68
         }
69 69
 
70
-        if (! empty($post['ResultWinner'])) {
70
+        if (!empty($post['ResultWinner'])) {
71 71
             if ($this->inputValidator->validatePostVars(
72 72
                 'ResultWinner',
73 73
                 $post['ResultWinner']
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             }
81 81
         }
82 82
 
83
-        if (! empty($post['ResultAlertCont'])) {
83
+        if (!empty($post['ResultAlertCont'])) {
84 84
             if ($this->inputValidator->validatePostVars(
85 85
                 'ResultAlertCont',
86 86
                 $post['ResultAlertCont']
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
             }
94 94
         }
95 95
 
96
-        if (! empty($post['ResultDomination'])) {
96
+        if (!empty($post['ResultDomination'])) {
97 97
             if ($this->inputValidator->validatePostVars(
98 98
                 'ResultDomination',
99 99
                 $post['ResultDomination']
Please login to merge, or discard this patch.