@@ -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 | // 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 |
||
| 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 | |
@@ -15,24 +15,24 @@ |
||
| 15 | 15 | |
| 16 | 16 | // Inflectors |
| 17 | 17 | $container->inflector('Ps2alerts\Api\Contract\ConfigAwareInterface') |
| 18 | - ->invokeMethod('setConfig', ['config']); |
|
| 18 | + ->invokeMethod('setConfig', ['config']); |
|
| 19 | 19 | $container->inflector('Ps2alerts\Api\Contract\DatabaseAwareInterface') |
| 20 | - ->invokeMethod('setDatabaseDriver', ['Aura\Sql']); |
|
| 20 | + ->invokeMethod('setDatabaseDriver', ['Aura\Sql']); |
|
| 21 | 21 | $container->inflector('Ps2alerts\Api\Contract\TemplateAwareInterface') |
| 22 | - ->invokeMethod('setTemplateDriver', ['Twig_Environment']); |
|
| 22 | + ->invokeMethod('setTemplateDriver', ['Twig_Environment']); |
|
| 23 | 23 | $container->inflector('Ps2alerts\Api\Contract\RedisAwareInterface') |
| 24 | - ->invokeMethod('setRedisDriver', ['redis']); |
|
| 24 | + ->invokeMethod('setRedisDriver', ['redis']); |
|
| 25 | 25 | |
| 26 | 26 | $container->add('Ps2alerts\Api\Validator\AlertInputValidator'); |
| 27 | 27 | |
| 28 | 28 | $container->add('Ps2alerts\Api\Repository\AlertRepository'); |
| 29 | 29 | |
| 30 | 30 | $container->add('Ps2alerts\Api\Loader\Statistics\AlertStatisticsLoader') |
| 31 | - ->withArgument('Ps2alerts\Api\Repository\AlertRepository') |
|
| 32 | - ->withArgument('Ps2alerts\Api\Validator\AlertInputValidator'); |
|
| 31 | + ->withArgument('Ps2alerts\Api\Repository\AlertRepository') |
|
| 32 | + ->withArgument('Ps2alerts\Api\Validator\AlertInputValidator'); |
|
| 33 | 33 | |
| 34 | 34 | // Container Inflector |
| 35 | 35 | $container->inflector('League\Container\ContainerAwareInterface') |
| 36 | - ->invokeMethod('setContainer', [$container]); |
|
| 36 | + ->invokeMethod('setContainer', [$container]); |
|
| 37 | 37 | |
| 38 | 38 | return $container; |
@@ -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': |
@@ -54,7 +54,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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'] |
@@ -49,26 +49,26 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function appendRedisKey($post, $redisKey) |
| 51 | 51 | { |
| 52 | - if (! empty($post['selects'])) { |
|
| 52 | + if (!empty($post['selects'])) { |
|
| 53 | 53 | $whereMD5 = md5($post['selects']); |
| 54 | 54 | $redisKey .= "/select{$whereMD5}"; |
| 55 | 55 | } |
| 56 | - if (! empty($post['wheres'])) { |
|
| 56 | + if (!empty($post['wheres'])) { |
|
| 57 | 57 | $whereMD5 = md5($post['wheres']); |
| 58 | 58 | $redisKey .= "/where{$whereMD5}"; |
| 59 | 59 | } |
| 60 | - if (! empty($post['orderBy'])) { |
|
| 60 | + if (!empty($post['orderBy'])) { |
|
| 61 | 61 | $orderMD5 = md5($post['orderBy']); |
| 62 | 62 | $redisKey .= "/order{$orderMD5}"; |
| 63 | 63 | } |
| 64 | - if (! empty($post['limit'])) { |
|
| 64 | + if (!empty($post['limit'])) { |
|
| 65 | 65 | // Enforce a max limit |
| 66 | 66 | if ($post['limit'] > 50) { |
| 67 | 67 | $post['limit'] = 50; |
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if (empty($post['limit']) || ! isset($post['limit'])) { |
|
| 71 | + if (empty($post['limit']) || !isset($post['limit'])) { |
|
| 72 | 72 | $post['limit'] = 10; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -86,15 +86,15 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function processPostVars($post) |
| 88 | 88 | { |
| 89 | - if (! empty($post['wheres'])) { |
|
| 89 | + if (!empty($post['wheres'])) { |
|
| 90 | 90 | $return['wheres'] = json_decode($post['wheres'], true); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - if (! empty($post['orderBy'])) { |
|
| 93 | + if (!empty($post['orderBy'])) { |
|
| 94 | 94 | $return['orderBy'] = json_decode($post['orderBy'], true); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if (empty($post['limit']) || ! isset($post['limit'])) { |
|
| 97 | + if (empty($post['limit']) || !isset($post['limit'])) { |
|
| 98 | 98 | $post['limit'] = 10; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -133,14 +133,14 @@ discard block |
||
| 133 | 133 | ]); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - if (! empty($post['orderBy'])) { |
|
| 136 | + if (!empty($post['orderBy'])) { |
|
| 137 | 137 | $queryObject->setOrderBy(array_keys($post['orderBy'])[0]); |
| 138 | 138 | $queryObject->setOrderByDirection(array_values($post['orderBy'])[0]); |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | $queryObject->setLimit($post['limit']); |
| 142 | 142 | |
| 143 | - if (! empty($this->getFlags())) { |
|
| 143 | + if (!empty($this->getFlags())) { |
|
| 144 | 144 | // If there are some funky things we have to do, set them. |
| 145 | 145 | $queryObject->setFlags($this->getFlags()); |
| 146 | 146 | } |