@@ -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 |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | /** |
| 13 | 13 | * Construct |
| 14 | 14 | * |
| 15 | - * @param \Ps2alerts\Api\Loader\Metrics\OutfitTotalsMetricsLoader $loader |
|
| 15 | + * @param OutfitTotalsMetricsLoader $loader |
|
| 16 | 16 | */ |
| 17 | 17 | public function __construct(OutfitTotalsMetricsLoader $loader) |
| 18 | 18 | { |
@@ -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) |
@@ -10,10 +10,10 @@ |
||
| 10 | 10 | use RedisAwareTrait; |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | - * Flag whether or not the result is allowed to be cached |
|
| 14 | - * |
|
| 15 | - * @var boolean |
|
| 16 | - */ |
|
| 13 | + * Flag whether or not the result is allowed to be cached |
|
| 14 | + * |
|
| 15 | + * @var boolean |
|
| 16 | + */ |
|
| 17 | 17 | |
| 18 | 18 | protected $cacheable = true; |
| 19 | 19 | /** |
@@ -9,6 +9,9 @@ |
||
| 9 | 9 | { |
| 10 | 10 | protected $flags; |
| 11 | 11 | |
| 12 | + /** |
|
| 13 | + * @param string $flag |
|
| 14 | + */ |
|
| 12 | 15 | public function setFlags($flag) |
| 13 | 16 | { |
| 14 | 17 | $this->flags = $flag; |
@@ -26,22 +26,22 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | public function appendRedisKey($post, $redisKey) |
| 28 | 28 | { |
| 29 | - if (! empty($post['wheres'])) { |
|
| 29 | + if (!empty($post['wheres'])) { |
|
| 30 | 30 | $whereMD5 = md5($post['wheres']); |
| 31 | 31 | $redisKey .= "/{$whereMD5}"; |
| 32 | 32 | } |
| 33 | - if (! empty($post['orderBy'])) { |
|
| 33 | + if (!empty($post['orderBy'])) { |
|
| 34 | 34 | $orderMD5 = md5($post['orderBy']); |
| 35 | 35 | $redisKey .= "/{$orderMD5}"; |
| 36 | 36 | } |
| 37 | - if (! empty($post['limit'])) { |
|
| 37 | + if (!empty($post['limit'])) { |
|
| 38 | 38 | // Enforce a max limit |
| 39 | 39 | if ($post['limit'] > 50) { |
| 40 | 40 | $post['limit'] = 50; |
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - if (empty($post['limit']) || ! isset($post['limit'])) { |
|
| 44 | + if (empty($post['limit']) || !isset($post['limit'])) { |
|
| 45 | 45 | $post['limit'] = 10; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -52,15 +52,15 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | public function processPostVars($post) |
| 54 | 54 | { |
| 55 | - if (! empty($post['wheres'])) { |
|
| 55 | + if (!empty($post['wheres'])) { |
|
| 56 | 56 | $return['wheres'] = json_decode($post['wheres'], true); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if (! empty($post['orderBy'])) { |
|
| 59 | + if (!empty($post['orderBy'])) { |
|
| 60 | 60 | $return['orderBy'] = json_decode($post['orderBy'], true); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - if (empty($post['limit']) || ! isset($post['limit'])) { |
|
| 63 | + if (empty($post['limit']) || !isset($post['limit'])) { |
|
| 64 | 64 | $post['limit'] = 10; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -97,14 +97,14 @@ discard block |
||
| 97 | 97 | ]); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if (! empty($post['orderBy'])) { |
|
| 100 | + if (!empty($post['orderBy'])) { |
|
| 101 | 101 | $queryObject->setOrderBy(array_keys($post['orderBy'])[0]); |
| 102 | 102 | $queryObject->setOrderByDirection(array_values($post['orderBy'])[0]); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | $queryObject->setLimit($post['limit']); |
| 106 | 106 | |
| 107 | - if (! empty($this->getFlags())) { |
|
| 107 | + if (!empty($this->getFlags())) { |
|
| 108 | 108 | // If there are some funky things we have to do, set them. |
| 109 | 109 | $queryObject->setFlags($this->getFlags()); |
| 110 | 110 | } |
@@ -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 | { |
@@ -15,13 +15,13 @@ discard block |
||
| 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 | // Repositories |
| 27 | 27 | $container->add('Ps2alerts\Api\Repository\ResultRepository'); |
@@ -32,27 +32,27 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | // Loaders |
| 34 | 34 | $container->add('Ps2alerts\Api\Loader\Metrics\MapMetricsLoader') |
| 35 | - ->withArgument('Ps2alerts\Api\Repository\Metrics\MapRepository'); |
|
| 35 | + ->withArgument('Ps2alerts\Api\Repository\Metrics\MapRepository'); |
|
| 36 | 36 | $container->add('Ps2alerts\Api\Loader\Metrics\MapInitialMetricsLoader') |
| 37 | - ->withArgument('Ps2alerts\Api\Repository\Metrics\MapInitialRepository'); |
|
| 37 | + ->withArgument('Ps2alerts\Api\Repository\Metrics\MapInitialRepository'); |
|
| 38 | 38 | $container->add('Ps2alerts\Api\Loader\Metrics\OutfitMetricsLoader') |
| 39 | - ->withArgument('Ps2alerts\Api\Repository\Metrics\OutfitRepository'); |
|
| 39 | + ->withArgument('Ps2alerts\Api\Repository\Metrics\OutfitRepository'); |
|
| 40 | 40 | $container->add('Ps2alerts\Api\Loader\ResultLoader') |
| 41 | - ->withArgument('Ps2alerts\Api\Repository\ResultRepository'); |
|
| 41 | + ->withArgument('Ps2alerts\Api\Repository\ResultRepository'); |
|
| 42 | 42 | |
| 43 | 43 | // Endpoint Injectors |
| 44 | 44 | $container->add('Ps2alerts\Api\Controller\Alerts\ResultsEndpointController') |
| 45 | - ->withArgument('Ps2alerts\Api\Loader\ResultLoader'); |
|
| 45 | + ->withArgument('Ps2alerts\Api\Loader\ResultLoader'); |
|
| 46 | 46 | // Metrics Endpoints |
| 47 | 47 | $container->add('Ps2alerts\Api\Controller\Metrics\MapMetricsEndpoint') |
| 48 | - ->withArgument('Ps2alerts\Api\Loader\Metrics\MapMetricsLoader'); |
|
| 48 | + ->withArgument('Ps2alerts\Api\Loader\Metrics\MapMetricsLoader'); |
|
| 49 | 49 | $container->add('Ps2alerts\Api\Controller\Metrics\MapInitialMetricsEndpoint') |
| 50 | - ->withArgument('Ps2alerts\Api\Loader\Metrics\MapInitialMetricsLoader'); |
|
| 50 | + ->withArgument('Ps2alerts\Api\Loader\Metrics\MapInitialMetricsLoader'); |
|
| 51 | 51 | $container->add('Ps2alerts\Api\Controller\Metrics\OutfitMetricsEndpoint') |
| 52 | - ->withArgument('Ps2alerts\Api\Loader\Metrics\OutfitMetricsLoader'); |
|
| 52 | + ->withArgument('Ps2alerts\Api\Loader\Metrics\OutfitMetricsLoader'); |
|
| 53 | 53 | |
| 54 | 54 | // Container Inflector |
| 55 | 55 | $container->inflector('League\Container\ContainerAwareInterface') |
| 56 | - ->invokeMethod('setContainer', [$container]); |
|
| 56 | + ->invokeMethod('setContainer', [$container]); |
|
| 57 | 57 | |
| 58 | 58 | return $container; |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $query->cols(['*']); |
| 68 | 68 | |
| 69 | 69 | // Workarounds :-/ |
| 70 | - if (! empty($queryObject->getFlags())) { |
|
| 70 | + if (!empty($queryObject->getFlags())) { |
|
| 71 | 71 | if ($queryObject->getFlags() === 'outfitIDs') { |
| 72 | 72 | // Prevent the VS, NC and TR "no outfit" workaround |
| 73 | 73 | $queryObject->addWhere([ |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // Setup where statements |
| 82 | - if (! empty($queryObject->getWheres())) { |
|
| 82 | + if (!empty($queryObject->getWheres())) { |
|
| 83 | 83 | foreach ($queryObject->getWheres() as $where) { |
| 84 | 84 | if ($where['col'] === 'primary') { |
| 85 | 85 | $col = $this->getPrimaryKey(); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | // Set up order statement |
| 98 | - if (! empty($queryObject->getOrderBy())) { |
|
| 98 | + if (!empty($queryObject->getOrderBy())) { |
|
| 99 | 99 | $orderBy = $queryObject->getOrderBy(); |
| 100 | 100 | if ($orderBy === 'primary') { |
| 101 | 101 | $orderBy = $this->getPrimaryKey(); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | ]); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - if (! empty($queryObject->getLimit())) { |
|
| 111 | + if (!empty($queryObject->getLimit())) { |
|
| 112 | 112 | $query->limit($queryObject->getLimit()); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -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'] |