@@ -72,7 +72,6 @@ discard block |
||
72 | 72 | /** |
73 | 73 | * Gets the Cache namespace key for Redis |
74 | 74 | * |
75 | - * @param string $string |
|
76 | 75 | */ |
77 | 76 | public function getCacheNamespace() |
78 | 77 | { |
@@ -145,7 +144,7 @@ discard block |
||
145 | 144 | * Sets JSON encoded value within Redis with an expiry in seconds |
146 | 145 | * |
147 | 146 | * @param string $key |
148 | - * @param mixed $value Data to encode into JSON and store |
|
147 | + * @param string $value Data to encode into JSON and store |
|
149 | 148 | * @param integer $expires Cache expiry time in seconds |
150 | 149 | */ |
151 | 150 | public function setExpireKey($key, $value, $expires) |
@@ -149,7 +149,7 @@ |
||
149 | 149 | * Takes common requests and appends them to the query object. Any other |
150 | 150 | * special requirements will be handled after |
151 | 151 | * |
152 | - * @param Ps2alerts\Api\QueryObjects\QueryObject $queryObject |
|
152 | + * @param QueryObject $queryObject |
|
153 | 153 | * @param array $post |
154 | 154 | * |
155 | 155 | * @return Ps2alerts\Api\QueryObjects\QueryObject |
@@ -75,33 +75,33 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function appendRedisKey($post, $redisKey) |
77 | 77 | { |
78 | - if (! empty($post['selects'])) { |
|
78 | + if (!empty($post['selects'])) { |
|
79 | 79 | $whereMD5 = md5($post['selects']); |
80 | 80 | $redisKey .= "/select{$whereMD5}"; |
81 | 81 | } |
82 | 82 | |
83 | - if (! empty($post['wheres'])) { |
|
83 | + if (!empty($post['wheres'])) { |
|
84 | 84 | $whereMD5 = md5($post['wheres']); |
85 | 85 | $redisKey .= "/where{$whereMD5}"; |
86 | 86 | } |
87 | 87 | |
88 | - if (! empty($post['whereIns'])) { |
|
88 | + if (!empty($post['whereIns'])) { |
|
89 | 89 | $whereInMD5 = md5($post['whereIns']); |
90 | 90 | $redisKey .= "/whereIn{$whereInMD5}"; |
91 | 91 | } |
92 | 92 | |
93 | - if (! empty($post['orderBy'])) { |
|
93 | + if (!empty($post['orderBy'])) { |
|
94 | 94 | $orderMD5 = md5($post['orderBy']); |
95 | 95 | $redisKey .= "/order{$orderMD5}"; |
96 | 96 | } |
97 | - if (! empty($post['limit'])) { |
|
97 | + if (!empty($post['limit'])) { |
|
98 | 98 | // Enforce a max limit |
99 | 99 | if ($post['limit'] > 50) { |
100 | 100 | $post['limit'] = 50; |
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - if (empty($post['limit']) || ! isset($post['limit'])) { |
|
104 | + if (empty($post['limit']) || !isset($post['limit'])) { |
|
105 | 105 | $post['limit'] = 10; |
106 | 106 | } |
107 | 107 | |
@@ -119,20 +119,20 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function processPostVars($post) |
121 | 121 | { |
122 | - if (! empty($post['wheres'])) { |
|
122 | + if (!empty($post['wheres'])) { |
|
123 | 123 | $return['wheres'] = json_decode($post['wheres'], true); |
124 | 124 | $this->getLogDriver()->addDebug(json_encode($return['wheres'])); |
125 | 125 | } |
126 | 126 | |
127 | - if (! empty($post['whereIns'])) { |
|
127 | + if (!empty($post['whereIns'])) { |
|
128 | 128 | $return['whereIns'] = json_decode($post['whereIns'], true); |
129 | 129 | } |
130 | 130 | |
131 | - if (! empty($post['orderBy'])) { |
|
131 | + if (!empty($post['orderBy'])) { |
|
132 | 132 | $return['orderBy'] = json_decode($post['orderBy'], true); |
133 | 133 | } |
134 | 134 | |
135 | - if (empty($post['limit']) || ! isset($post['limit'])) { |
|
135 | + if (empty($post['limit']) || !isset($post['limit'])) { |
|
136 | 136 | $post['limit'] = 10; |
137 | 137 | } |
138 | 138 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function setupQueryObject($queryObject, $post) |
158 | 158 | { |
159 | - if (! empty($post['wheres'])) { |
|
159 | + if (!empty($post['wheres'])) { |
|
160 | 160 | foreach ($post['wheres'] as $key => $value) { |
161 | 161 | $queryObject->addWhere([ |
162 | 162 | 'col' => $key, |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | - if (! empty($post['whereIns'])) { |
|
168 | + if (!empty($post['whereIns'])) { |
|
169 | 169 | foreach ($post['whereIns'] as $key => $value) { |
170 | 170 | // Escape strings manually, incase of player IDs etc |
171 | 171 | foreach ($value as $i => $val) { |
@@ -181,16 +181,16 @@ discard block |
||
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | - if (! empty($post['orderBy'])) { |
|
184 | + if (!empty($post['orderBy'])) { |
|
185 | 185 | $queryObject->setOrderBy(array_keys($post['orderBy'])[0]); |
186 | 186 | $queryObject->setOrderByDirection(array_values($post['orderBy'])[0]); |
187 | 187 | } |
188 | 188 | |
189 | - if (! empty($post['limit'])) { |
|
189 | + if (!empty($post['limit'])) { |
|
190 | 190 | $queryObject->setLimit($post['limit']); |
191 | 191 | } |
192 | 192 | |
193 | - if (! empty($this->getFlags())) { |
|
193 | + if (!empty($this->getFlags())) { |
|
194 | 194 | // If there are some funky things we have to do, set them. |
195 | 195 | $queryObject->setFlags($this->getFlags()); |
196 | 196 | } |
@@ -54,7 +54,7 @@ |
||
54 | 54 | * in the array and added to. |
55 | 55 | * e.g. $queryObject->addSelect('COUNT(ResultID) AS COUNT'); |
56 | 56 | * |
57 | - * @param string $string |
|
57 | + * @param string $array |
|
58 | 58 | */ |
59 | 59 | public function addSelect($array) |
60 | 60 | { |
@@ -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) && is_numeric($limit)) { |
|
187 | + if (!empty($limit) && is_numeric($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 | } |
@@ -66,14 +66,14 @@ discard block |
||
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 |
||
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 |
||
104 | 104 | } |
105 | 105 | |
106 | 106 | // Setup where statements |
107 | - if (! empty($queryObject->getWhereIns())) { |
|
107 | + if (!empty($queryObject->getWhereIns())) { |
|
108 | 108 | foreach ($queryObject->getWhereIns() as $whereIn) { |
109 | 109 | $col = $whereIn['col']; |
110 | 110 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | } |
121 | 121 | |
122 | 122 | // Set up order statement |
123 | - if (! empty($queryObject->getOrderBy())) { |
|
123 | + if (!empty($queryObject->getOrderBy())) { |
|
124 | 124 | $orderBy = $queryObject->getOrderBy(); |
125 | 125 | if ($orderBy === 'primary') { |
126 | 126 | $orderBy = $this->getPrimaryKey(); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | ]); |
135 | 135 | } |
136 | 136 | |
137 | - if (! empty($queryObject->getLimit())) { |
|
137 | + if (!empty($queryObject->getLimit())) { |
|
138 | 138 | $query->limit($queryObject->getLimit()); |
139 | 139 | } |
140 | 140 |
@@ -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) |
@@ -88,9 +88,9 @@ |
||
88 | 88 | return $this->getFromRedis($masterRedisKey); |
89 | 89 | } |
90 | 90 | |
91 | - $servers = [1,10,13,17,25,1000,2000]; |
|
92 | - $zones = [2,4,6,8]; |
|
93 | - $factions = ['vs','nc','tr','draw']; |
|
91 | + $servers = [1, 10, 13, 17, 25, 1000, 2000]; |
|
92 | + $zones = [2, 4, 6, 8]; |
|
93 | + $factions = ['vs', 'nc', 'tr', 'draw']; |
|
94 | 94 | |
95 | 95 | $results = []; |
96 | 96 | $this->setCacheExpireTime(3600); // 1 Hour |
@@ -16,26 +16,26 @@ |
||
16 | 16 | |
17 | 17 | // Inflectors |
18 | 18 | $container->inflector('Ps2alerts\Api\Contract\ConfigAwareInterface') |
19 | - ->invokeMethod('setConfig', ['config']); |
|
19 | + ->invokeMethod('setConfig', ['config']); |
|
20 | 20 | $container->inflector('Ps2alerts\Api\Contract\DatabaseAwareInterface') |
21 | - ->invokeMethod('setDatabaseDriver', ['Aura\Sql']); |
|
21 | + ->invokeMethod('setDatabaseDriver', ['Aura\Sql']); |
|
22 | 22 | $container->inflector('Ps2alerts\Api\Contract\LogAwareInterface') |
23 | - ->invokeMethod('setLogDriver', ['Monolog\Logger']); |
|
23 | + ->invokeMethod('setLogDriver', ['Monolog\Logger']); |
|
24 | 24 | $container->inflector('Ps2alerts\Api\Contract\TemplateAwareInterface') |
25 | - ->invokeMethod('setTemplateDriver', ['Twig_Environment']); |
|
25 | + ->invokeMethod('setTemplateDriver', ['Twig_Environment']); |
|
26 | 26 | $container->inflector('Ps2alerts\Api\Contract\RedisAwareInterface') |
27 | - ->invokeMethod('setRedisDriver', ['redis']); |
|
27 | + ->invokeMethod('setRedisDriver', ['redis']); |
|
28 | 28 | |
29 | 29 | $container->add('Ps2alerts\Api\Validator\AlertInputValidator'); |
30 | 30 | |
31 | 31 | $container->add('Ps2alerts\Api\Repository\AlertRepository'); |
32 | 32 | |
33 | 33 | $container->add('Ps2alerts\Api\Loader\Statistics\AlertStatisticsLoader') |
34 | - ->withArgument('Ps2alerts\Api\Repository\AlertRepository') |
|
35 | - ->withArgument('Ps2alerts\Api\Validator\AlertInputValidator'); |
|
34 | + ->withArgument('Ps2alerts\Api\Repository\AlertRepository') |
|
35 | + ->withArgument('Ps2alerts\Api\Validator\AlertInputValidator'); |
|
36 | 36 | |
37 | 37 | // Container Inflector |
38 | 38 | $container->inflector('League\Container\ContainerAwareInterface') |
39 | - ->invokeMethod('setContainer', [$container]); |
|
39 | + ->invokeMethod('setContainer', [$container]); |
|
40 | 40 | |
41 | 41 | return $container; |