@@ -13,7 +13,7 @@ |
||
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 |
@@ -4,7 +4,6 @@ |
||
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 |
@@ -12,7 +12,7 @@ discard block |
||
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 |
||
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 | */ |
@@ -12,7 +12,7 @@ |
||
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 | { |
@@ -16,7 +16,7 @@ |
||
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 | { |
@@ -4,7 +4,6 @@ |
||
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 |
@@ -91,6 +91,9 @@ |
||
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)) { |
@@ -32,10 +32,10 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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': |
@@ -49,7 +49,7 @@ discard block |
||
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 |
||
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 | { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function setOrderBy($string) |
120 | 120 | { |
121 | - if (! empty($string)) { |
|
121 | + if (!empty($string)) { |
|
122 | 122 | $this->orderBy = $string; |
123 | 123 | } |
124 | 124 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function setOrderByDirection($string) |
142 | 142 | { |
143 | - if (! empty($string)) { |
|
143 | + if (!empty($string)) { |
|
144 | 144 | $this->orderByDirection = $string; |
145 | 145 | } |
146 | 146 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function setDimension($string) |
164 | 164 | { |
165 | - if (! empty($string)) { |
|
165 | + if (!empty($string)) { |
|
166 | 166 | $this->dimension = $string; |
167 | 167 | } |
168 | 168 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function setLimit($limit) |
186 | 186 | { |
187 | - if (! empty($limit)) { |
|
187 | + if (!empty($limit)) { |
|
188 | 188 | $this->limit = $limit; |
189 | 189 | } |
190 | 190 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function setFlags($flags) |
208 | 208 | { |
209 | - if (! empty($flags)) { |
|
209 | + if (!empty($flags)) { |
|
210 | 210 | $this->flags = $flags; |
211 | 211 | } |
212 | 212 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | 'value' => date('U', strtotime('-48 hours')) |
42 | 42 | ]); |
43 | 43 | |
44 | - if (! empty($args['serverID'])) { |
|
44 | + if (!empty($args['serverID'])) { |
|
45 | 45 | $redisKey .= ":{$args['serverID']}"; |
46 | 46 | $queryObject->addWhere([ |
47 | 47 | 'col' => 'ResultServer', |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | ]); |
50 | 50 | } |
51 | 51 | |
52 | - if (! empty($args['limit'])) { |
|
52 | + if (!empty($args['limit'])) { |
|
53 | 53 | if ($args['limit'] > 50) { |
54 | 54 | $args['limit'] = 50; |
55 | 55 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | 'value' => 1 |
82 | 82 | ]); |
83 | 83 | |
84 | - if (! empty($args['serverID'])) { |
|
84 | + if (!empty($args['serverID'])) { |
|
85 | 85 | $queryObject->addWhere([ |
86 | 86 | 'col' => 'ResultServer', |
87 | 87 | 'value' => $args['serverID'] |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public function register() |
22 | 22 | { |
23 | - $this->getContainer()->singleton('Monolog\Logger', function () { |
|
23 | + $this->getContainer()->singleton('Monolog\Logger', function() { |
|
24 | 24 | $log = new Logger('app'); |
25 | 25 | $log->pushHandler( |
26 | 26 | new StreamHandler(__DIR__ . '/../../logs/app.log', Logger::DEBUG) |