@@ -70,14 +70,14 @@ discard block |
||
| 70 | 70 | $query = $this->newQuery(); |
| 71 | 71 | |
| 72 | 72 | // Setup select statements |
| 73 | - if (! empty($queryObject->getSelects())) { |
|
| 73 | + if (!empty($queryObject->getSelects())) { |
|
| 74 | 74 | $query->cols($queryObject->getSelects()); |
| 75 | 75 | } else { |
| 76 | 76 | $query->cols(['*']); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | // Workarounds :-/ |
| 80 | - if (! empty($queryObject->getFlags())) { |
|
| 80 | + if (!empty($queryObject->getFlags())) { |
|
| 81 | 81 | if ($queryObject->getFlags() === 'outfitIDs') { |
| 82 | 82 | // Prevent the VS, NC and TR "no outfit" workaround |
| 83 | 83 | $queryObject->addWhere([ |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | // Setup where statements |
| 92 | - if (! empty($queryObject->getWheres())) { |
|
| 92 | + if (!empty($queryObject->getWheres())) { |
|
| 93 | 93 | foreach ($queryObject->getWheres() as $where) { |
| 94 | 94 | $col = $where['col']; |
| 95 | 95 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | // Generate a UUID so that any columns that are used multiple |
| 104 | 104 | // times always have unique values. Tiny overhead for the benefit |
| 105 | 105 | $uuid = $this->getUuidDriver()->uuid4()->toString(); |
| 106 | - $bind = str_replace('-', '', $col.$uuid); |
|
| 106 | + $bind = str_replace('-', '', $col . $uuid); |
|
| 107 | 107 | |
| 108 | 108 | $op = (isset($where['op']) ? $where['op'] : '='); |
| 109 | 109 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | // Setup where statements |
| 116 | - if (! empty($queryObject->getWhereIns())) { |
|
| 116 | + if (!empty($queryObject->getWhereIns())) { |
|
| 117 | 117 | foreach ($queryObject->getWhereIns() as $whereIn) { |
| 118 | 118 | $col = $whereIn['col']; |
| 119 | 119 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | // Set up order statement |
| 132 | - if (! empty($queryObject->getOrderBy())) { |
|
| 132 | + if (!empty($queryObject->getOrderBy())) { |
|
| 133 | 133 | $orderBy = $queryObject->getOrderBy(); |
| 134 | 134 | if ($orderBy === 'primary') { |
| 135 | 135 | $orderBy = $this->getPrimaryKey(); |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | ]); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - if (! empty($queryObject->getLimit())) { |
|
| 146 | + if (!empty($queryObject->getLimit())) { |
|
| 147 | 147 | // Only set a limit if it's required |
| 148 | 148 | if ($queryObject->getLimit() !== 'unlimited') { |
| 149 | 149 | $query->limit($queryObject->getLimit()); |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | public function register() |
| 21 | 21 | { |
| 22 | - $this->getContainer()->add('Ramsey\Uuid\Uuid', function () { |
|
| 22 | + $this->getContainer()->add('Ramsey\Uuid\Uuid', function() { |
|
| 23 | 23 | $uuid = Uuid::Uuid4(); |
| 24 | 24 | return $uuid; |
| 25 | 25 | }); |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | return $this->getFromRedis($masterRedisKey); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - $servers = [1,10,13,17,25,1000,2000]; |
|
| 97 | - $zones = [2,4,6,8]; |
|
| 98 | - $factions = ['vs','nc','tr','draw']; |
|
| 96 | + $servers = [1, 10, 13, 17, 25, 1000, 2000]; |
|
| 97 | + $zones = [2, 4, 6, 8]; |
|
| 98 | + $factions = ['vs', 'nc', 'tr', 'draw']; |
|
| 99 | 99 | |
| 100 | 100 | $results = []; |
| 101 | 101 | $this->setCacheExpireTime(3600); // 1 Hour |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $maxDate = date('Y-m-d'); // Today unless set |
| 188 | 188 | |
| 189 | 189 | // If there is a minimum date set |
| 190 | - if (! empty($post['wheres']['morethan']['ResultEndTime'])) { |
|
| 190 | + if (!empty($post['wheres']['morethan']['ResultEndTime'])) { |
|
| 191 | 191 | if (is_integer($post['wheres']['morethan']['ResultEndTime'])) { |
| 192 | 192 | $minDate = date('Y-m-d', $post['wheres']['morethan']['ResultEndTime']); |
| 193 | 193 | } else { |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | // If there is a maximum date set |
| 199 | - if (! empty($post['wheres']['lessthan']['ResultEndTime'])) { |
|
| 199 | + if (!empty($post['wheres']['lessthan']['ResultEndTime'])) { |
|
| 200 | 200 | if (is_integer($post['wheres']['lessthan']['ResultEndTime'])) { |
| 201 | 201 | $maxDate = date('Y-m-d', $post['wheres']['lessthan']['ResultEndTime']); |
| 202 | 202 | } else { |
@@ -254,11 +254,11 @@ discard block |
||
| 254 | 254 | $minDate = date('U', strtotime("-24 hours")); |
| 255 | 255 | $maxDate = date('U'); |
| 256 | 256 | |
| 257 | - if (! empty($post['minDate'])) { |
|
| 257 | + if (!empty($post['minDate'])) { |
|
| 258 | 258 | $minDate = date('U', $post['minDate']); |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - if (! empty($post['maxDate'])) { |
|
| 261 | + if (!empty($post['maxDate'])) { |
|
| 262 | 262 | $maxDate = date('U', $post['maxDate']); |
| 263 | 263 | } |
| 264 | 264 | |
@@ -274,14 +274,14 @@ discard block |
||
| 274 | 274 | 'value' => $maxDate |
| 275 | 275 | ]); |
| 276 | 276 | |
| 277 | - if (! empty($post['server'])) { |
|
| 277 | + if (!empty($post['server'])) { |
|
| 278 | 278 | $queryObject->addWhere([ |
| 279 | 279 | 'col' => 'ResultServer', |
| 280 | 280 | 'value' => $post['server'] |
| 281 | 281 | ]); |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - if (! empty($post['faction'])) { |
|
| 284 | + if (!empty($post['faction'])) { |
|
| 285 | 285 | $queryObject->addWhere([ |
| 286 | 286 | 'col' => 'ResultWinner', |
| 287 | 287 | 'value' => $post['faction'] |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | $queryObject->setOrderBy('result'); |
| 294 | 294 | $queryObject->setOrderByDirection('desc'); |
| 295 | 295 | |
| 296 | - if (! empty($post['orderBy'])) { |
|
| 296 | + if (!empty($post['orderBy'])) { |
|
| 297 | 297 | if ($post['orderBy'] === 'asc' || $post['orderBy'] === 'desc') { |
| 298 | 298 | $queryObject->setOrderByDirection($post['orderBy']); |
| 299 | 299 | } |
@@ -75,27 +75,27 @@ 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(json_encode($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(json_encode($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(json_encode($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(json_encode($post['orderBy'])); |
| 95 | 95 | $redisKey .= "/order:{$orderMD5}"; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - if (empty($post['limit']) || ! isset($post['limit'])) { |
|
| 98 | + if (empty($post['limit']) || !isset($post['limit'])) { |
|
| 99 | 99 | $redisKey .= "/limit:{$post['limit']}"; |
| 100 | 100 | } |
| 101 | 101 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | // Cheat, dirty hack to get everything out as an array |
| 118 | 118 | $post = json_decode(json_encode($post), true); |
| 119 | 119 | |
| 120 | - if (empty($post['limit']) || ! isset($post['limit'])) { |
|
| 120 | + if (empty($post['limit']) || !isset($post['limit'])) { |
|
| 121 | 121 | $post['limit'] = 10; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function setupQueryObject(QueryObject $queryObject, array $post) |
| 141 | 141 | { |
| 142 | - if (! empty($post['wheres'])) { |
|
| 142 | + if (!empty($post['wheres'])) { |
|
| 143 | 143 | foreach ($post['wheres'] as $key => $value) { |
| 144 | 144 | if ($key !== 'lessthan' && $key !== 'morethan') { |
| 145 | 145 | $queryObject->addWhere([ |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - if (! empty($post['wheres']['lessthan'])) { |
|
| 152 | + if (!empty($post['wheres']['lessthan'])) { |
|
| 153 | 153 | foreach ($post['wheres']['lessthan'] as $key => $value) { |
| 154 | 154 | $queryObject->addWhere([ |
| 155 | 155 | 'col' => $key, |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - if (! empty($post['wheres']['morethan'])) { |
|
| 162 | + if (!empty($post['wheres']['morethan'])) { |
|
| 163 | 163 | foreach ($post['wheres']['morethan'] as $key => $value) { |
| 164 | 164 | $queryObject->addWhere([ |
| 165 | 165 | 'col' => $key, |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - if (! empty($post['whereIns'])) { |
|
| 173 | + if (!empty($post['whereIns'])) { |
|
| 174 | 174 | foreach ($post['whereIns'] as $key => $value) { |
| 175 | 175 | // Escape strings manually, incase of player IDs etc |
| 176 | 176 | foreach ($value as $i => $val) { |
@@ -186,16 +186,16 @@ discard block |
||
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - if (! empty($post['orderBy'])) { |
|
| 189 | + if (!empty($post['orderBy'])) { |
|
| 190 | 190 | $queryObject->setOrderBy(array_keys($post['orderBy'])[0]); |
| 191 | 191 | $queryObject->setOrderByDirection(array_values($post['orderBy'])[0]); |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - if (! empty($post['limit'])) { |
|
| 194 | + if (!empty($post['limit'])) { |
|
| 195 | 195 | $queryObject->setLimit($post['limit']); |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - if (! empty($this->getFlags())) { |
|
| 198 | + if (!empty($this->getFlags())) { |
|
| 199 | 199 | // If there are some funky things we have to do, set them. |
| 200 | 200 | $queryObject->setFlags($this->getFlags()); |
| 201 | 201 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | $response->setStatusCode(404)->setContent( |
| 29 | 29 | $container->get('Twig_Environment')->render('404.html') |
| 30 | 30 | ); |
| 31 | -} catch(\Exception $e) { |
|
| 31 | +} catch (\Exception $e) { |
|
| 32 | 32 | $response->setStatusCode(500)->setContent( |
| 33 | 33 | 'An error occured! ' . $e->getMessage() |
| 34 | 34 | ); |