@@ -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 | } |
@@ -150,10 +150,10 @@ |
||
| 150 | 150 | * Takes common requests and appends them to the query object. Any other |
| 151 | 151 | * special requirements will be handled after |
| 152 | 152 | * |
| 153 | - * @param Ps2alerts\Api\QueryObjects\QueryObject $queryObject |
|
| 153 | + * @param QueryObject $queryObject |
|
| 154 | 154 | * @param array $post |
| 155 | 155 | * |
| 156 | - * @return Ps2alerts\Api\QueryObjects\QueryObject |
|
| 156 | + * @return QueryObject |
|
| 157 | 157 | */ |
| 158 | 158 | public function setupQueryObject(QueryObject $queryObject, array $post) |
| 159 | 159 | { |
@@ -75,34 +75,34 @@ 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 | 97 | |
| 98 | - if (! empty($post['limit'])) { |
|
| 98 | + if (!empty($post['limit'])) { |
|
| 99 | 99 | // Enforce a max limit |
| 100 | 100 | if ($post['limit'] > 50) { |
| 101 | 101 | $post['limit'] = 50; |
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - if (empty($post['limit']) || ! isset($post['limit'])) { |
|
| 105 | + if (empty($post['limit']) || !isset($post['limit'])) { |
|
| 106 | 106 | $post['limit'] = 50; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -120,20 +120,20 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | public function processPostVars($post) |
| 122 | 122 | { |
| 123 | - if (! empty($post['wheres'])) { |
|
| 123 | + if (!empty($post['wheres'])) { |
|
| 124 | 124 | $return['wheres'] = json_decode($post['wheres'], true); |
| 125 | 125 | $this->getLogDriver()->addDebug(json_encode($return['wheres'])); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - if (! empty($post['whereIns'])) { |
|
| 128 | + if (!empty($post['whereIns'])) { |
|
| 129 | 129 | $return['whereIns'] = json_decode($post['whereIns'], true); |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - if (! empty($post['orderBy'])) { |
|
| 132 | + if (!empty($post['orderBy'])) { |
|
| 133 | 133 | $return['orderBy'] = json_decode($post['orderBy'], true); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - if (empty($post['limit']) || ! isset($post['limit'])) { |
|
| 136 | + if (empty($post['limit']) || !isset($post['limit'])) { |
|
| 137 | 137 | $post['limit'] = 10; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function setupQueryObject(QueryObject $queryObject, array $post) |
| 159 | 159 | { |
| 160 | - if (! empty($post['wheres'])) { |
|
| 160 | + if (!empty($post['wheres'])) { |
|
| 161 | 161 | foreach ($post['wheres'] as $key => $value) { |
| 162 | 162 | if ($key !== 'lessthan' && $key !== 'morethan') { |
| 163 | 163 | $queryObject->addWhere([ |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - if (! empty($post['wheres']['lessthan'])) { |
|
| 170 | + if (!empty($post['wheres']['lessthan'])) { |
|
| 171 | 171 | foreach ($post['wheres']['lessthan'] as $key => $value) { |
| 172 | 172 | $queryObject->addWhere([ |
| 173 | 173 | 'col' => $key, |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - if (! empty($post['wheres']['morethan'])) { |
|
| 180 | + if (!empty($post['wheres']['morethan'])) { |
|
| 181 | 181 | foreach ($post['wheres']['morethan'] as $key => $value) { |
| 182 | 182 | $queryObject->addWhere([ |
| 183 | 183 | 'col' => $key, |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - if (! empty($post['whereIns'])) { |
|
| 191 | + if (!empty($post['whereIns'])) { |
|
| 192 | 192 | foreach ($post['whereIns'] as $key => $value) { |
| 193 | 193 | // Escape strings manually, incase of player IDs etc |
| 194 | 194 | foreach ($value as $i => $val) { |
@@ -204,16 +204,16 @@ discard block |
||
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - if (! empty($post['orderBy'])) { |
|
| 207 | + if (!empty($post['orderBy'])) { |
|
| 208 | 208 | $queryObject->setOrderBy(array_keys($post['orderBy'])[0]); |
| 209 | 209 | $queryObject->setOrderByDirection(array_values($post['orderBy'])[0]); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - if (! empty($post['limit'])) { |
|
| 212 | + if (!empty($post['limit'])) { |
|
| 213 | 213 | $queryObject->setLimit($post['limit']); |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - if (! empty($this->getFlags())) { |
|
| 216 | + if (!empty($this->getFlags())) { |
|
| 217 | 217 | // If there are some funky things we have to do, set them. |
| 218 | 218 | $queryObject->setFlags($this->getFlags()); |
| 219 | 219 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | * Construct |
| 25 | 25 | * |
| 26 | 26 | * @param \Ps2alerts\Api\Repository\AlertRepository $repository |
| 27 | - * @param \Ps2alerts\Api\Helper\DataFormatter $dataFormatter |
|
| 27 | + * @param DataFormatterHelper $dataFormatter |
|
| 28 | 28 | */ |
| 29 | 29 | public function __construct( |
| 30 | 30 | AlertRepository $repository, |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Ps2alerts\Api\Loader\Statistics\AbstractStatisticsLoader; |
| 6 | 6 | use Ps2alerts\Api\QueryObjects\QueryObject; |
| 7 | 7 | use Ps2alerts\Api\Repository\AlertRepository; |
| 8 | -use Ps2alerts\Api\Validator\AlertInputValidator; |
|
| 9 | 8 | use Ps2alerts\Api\Helper\DataFormatterHelper; |
| 10 | 9 | |
| 11 | 10 | class AlertStatisticsLoader extends AbstractStatisticsLoader |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | return $this->getFromRedis($masterRedisKey); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - $servers = [1,10,13,17,25,1000,2000]; |
|
| 93 | - $zones = [2,4,6,8]; |
|
| 94 | - $factions = ['vs','nc','tr','draw']; |
|
| 92 | + $servers = [1, 10, 13, 17, 25, 1000, 2000]; |
|
| 93 | + $zones = [2, 4, 6, 8]; |
|
| 94 | + $factions = ['vs', 'nc', 'tr', 'draw']; |
|
| 95 | 95 | |
| 96 | 96 | $results = []; |
| 97 | 97 | $this->setCacheExpireTime(3600); // 1 Hour |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $maxDate = date('Y-m-d'); // Today unless set |
| 189 | 189 | |
| 190 | 190 | // If there is a minimum date set |
| 191 | - if (! empty($post['wheres']['morethan']['ResultEndTime'])) { |
|
| 191 | + if (!empty($post['wheres']['morethan']['ResultEndTime'])) { |
|
| 192 | 192 | if (is_integer($post['wheres']['morethan']['ResultEndTime'])) { |
| 193 | 193 | $minDate = date('Y-m-d', $post['wheres']['morethan']['ResultEndTime']); |
| 194 | 194 | } else { |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | // If there is a maximum date set |
| 200 | - if (! empty($post['wheres']['lessthan']['ResultEndTime'])) { |
|
| 200 | + if (!empty($post['wheres']['lessthan']['ResultEndTime'])) { |
|
| 201 | 201 | if (is_integer($post['wheres']['lessthan']['ResultEndTime'])) { |
| 202 | 202 | $maxDate = date('Y-m-d', $post['wheres']['lessthan']['ResultEndTime']); |
| 203 | 203 | } else { |
@@ -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 | }); |
@@ -17,17 +17,17 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | // Inflectors |
| 19 | 19 | $container->inflector('Ps2alerts\Api\Contract\ConfigAwareInterface') |
| 20 | - ->invokeMethod('setConfig', ['config']); |
|
| 20 | + ->invokeMethod('setConfig', ['config']); |
|
| 21 | 21 | $container->inflector('Ps2alerts\Api\Contract\DatabaseAwareInterface') |
| 22 | - ->invokeMethod('setDatabaseDriver', ['Aura\Sql']); |
|
| 22 | + ->invokeMethod('setDatabaseDriver', ['Aura\Sql']); |
|
| 23 | 23 | $container->inflector('Ps2alerts\Api\Contract\LogAwareInterface') |
| 24 | - ->invokeMethod('setLogDriver', ['Monolog\Logger']); |
|
| 24 | + ->invokeMethod('setLogDriver', ['Monolog\Logger']); |
|
| 25 | 25 | $container->inflector('Ps2alerts\Api\Contract\TemplateAwareInterface') |
| 26 | - ->invokeMethod('setTemplateDriver', ['Twig_Environment']); |
|
| 26 | + ->invokeMethod('setTemplateDriver', ['Twig_Environment']); |
|
| 27 | 27 | $container->inflector('Ps2alerts\Api\Contract\RedisAwareInterface') |
| 28 | - ->invokeMethod('setRedisDriver', ['redis']); |
|
| 28 | + ->invokeMethod('setRedisDriver', ['redis']); |
|
| 29 | 29 | $container->inflector('Ps2alerts\Api\Contract\UuidAwareInterface') |
| 30 | - ->invokeMethod('setUuidDriver', ['Ramsey\Uuid\Uuid']); |
|
| 30 | + ->invokeMethod('setUuidDriver', ['Ramsey\Uuid\Uuid']); |
|
| 31 | 31 | |
| 32 | 32 | // Repositories |
| 33 | 33 | $container->add('Ps2alerts\Api\Repository\AlertRepository'); |
@@ -35,11 +35,11 @@ discard block |
||
| 35 | 35 | $container->add('Ps2alerts\Api\Helper\DataFormatterHelper'); |
| 36 | 36 | |
| 37 | 37 | $container->add('Ps2alerts\Api\Loader\Statistics\AlertStatisticsLoader') |
| 38 | - ->withArgument('Ps2alerts\Api\Repository\AlertRepository') |
|
| 39 | - ->withArgument('Ps2alerts\Api\Helper\DataFormatterHelper'); |
|
| 38 | + ->withArgument('Ps2alerts\Api\Repository\AlertRepository') |
|
| 39 | + ->withArgument('Ps2alerts\Api\Helper\DataFormatterHelper'); |
|
| 40 | 40 | |
| 41 | 41 | // Container Inflector |
| 42 | 42 | $container->inflector('League\Container\ContainerAwareInterface') |
| 43 | - ->invokeMethod('setContainer', [$container]); |
|
| 43 | + ->invokeMethod('setContainer', [$container]); |
|
| 44 | 44 | |
| 45 | 45 | return $container; |