@@ -3,7 +3,7 @@ |
||
| 3 | 3 | $container = new League\Container\Container; |
| 4 | 4 | |
| 5 | 5 | // Register the request object singleton to be used later in the request cyncle |
| 6 | -$container->singleton('Symfony\Component\HttpFoundation\Request', function () { |
|
| 6 | +$container->singleton('Symfony\Component\HttpFoundation\Request', function() { |
|
| 7 | 7 | return Symfony\Component\HttpFoundation\Request::createFromGlobals(); |
| 8 | 8 | }); |
| 9 | 9 | |
@@ -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,13 +32,13 @@ |
||
| 32 | 32 | ]; |
| 33 | 33 | |
| 34 | 34 | // Register the singleton with the container |
| 35 | - $this->getContainer()->singleton('Twig_Environment', function () use ($globals, $config) { |
|
| 35 | + $this->getContainer()->singleton('Twig_Environment', function() use ($globals, $config) { |
|
| 36 | 36 | |
| 37 | 37 | $cache = false; |
| 38 | 38 | $debug = true; |
| 39 | 39 | |
| 40 | 40 | if ($config['environment'] === "production" || $config['environment'] === "staging") { |
| 41 | - $cache = __DIR__ .'/../../cache'; |
|
| 41 | + $cache = __DIR__ . '/../../cache'; |
|
| 42 | 42 | $debug = false; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | public function register() |
| 21 | 21 | { |
| 22 | - $this->getContainer()->singleton('Aura\Sql', function () { |
|
| 22 | + $this->getContainer()->singleton('Aura\Sql', function() { |
|
| 23 | 23 | $config = $this->getContainer()->get('config')['database']; |
| 24 | 24 | |
| 25 | 25 | $pdo = new ExtendedPdo( |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | public function register() |
| 20 | 20 | { |
| 21 | - $this->getContainer()->singleton('config', function () { |
|
| 21 | + $this->getContainer()->singleton('config', function() { |
|
| 22 | 22 | return include __DIR__ . '/../../config/config.php'; |
| 23 | 23 | }); |
| 24 | 24 | } |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | public function register() |
| 25 | 25 | { |
| 26 | - $this->getContainer()->singleton('redis', function () { |
|
| 26 | + $this->getContainer()->singleton('redis', function() { |
|
| 27 | 27 | $redisConfig = $this->getContainer()->get('config')['redis']; |
| 28 | 28 | |
| 29 | 29 | $client = new Client([ |
@@ -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 | /** |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | $redisKey = "{$this->getCacheNamespace()}{$id}:{$this->getType()}"; |
| 27 | 27 | |
| 28 | - if (! empty($this->getMetrics())) { |
|
| 28 | + if (!empty($this->getMetrics())) { |
|
| 29 | 29 | foreach ($this->getMetrics() as $metric) { |
| 30 | 30 | $redisKey .= ":{$metric['col']}{$op}{$metric['value']}"; |
| 31 | 31 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | 'value' => $id |
| 42 | 42 | ]); |
| 43 | 43 | |
| 44 | - if (! empty($this->getMetrics())) { |
|
| 44 | + if (!empty($this->getMetrics())) { |
|
| 45 | 45 | foreach ($this->getMetrics() as $metric) { |
| 46 | 46 | $op = (isset($metric['op']) ? $metric['op'] : '='); |
| 47 | 47 | $queryObject->addWhere([ |
@@ -65,10 +65,10 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function setMetrics($metric) |
| 67 | 67 | { |
| 68 | - if (! empty($metric)) { |
|
| 68 | + if (!empty($metric)) { |
|
| 69 | 69 | // Don't allow setting if the proper data isn't there. |
| 70 | 70 | // Prevents and kind of errors later on. |
| 71 | - if (! empty($metric['col']) && ! empty($metric['value'])) { |
|
| 71 | + if (!empty($metric['col']) && !empty($metric['value'])) { |
|
| 72 | 72 | $this->metrics[] = $metric; |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -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 | |
@@ -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': |