@@ -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 | |
@@ -17,21 +17,21 @@ |
||
| 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 | |
| 33 | 33 | // Container Inflector |
| 34 | 34 | $container->inflector('League\Container\ContainerAwareInterface') |
| 35 | - ->invokeMethod('setContainer', [$container]); |
|
| 35 | + ->invokeMethod('setContainer', [$container]); |
|
| 36 | 36 | |
| 37 | 37 | 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([ |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | public function register() |
| 22 | 22 | { |
| 23 | - $this->getContainer()->singleton('Monolog\Logger', function () { |
|
| 23 | + $this->getContainer()->singleton('Monolog\Logger', function() { |
|
| 24 | 24 | $log = new Logger('app'); |
| 25 | 25 | $log->pushHandler( |
| 26 | 26 | new StreamHandler(__DIR__ . '/../../logs/app.log', Logger::DEBUG) |
@@ -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 | }); |
@@ -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 | ); |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use League\Route\Http\JsonResponse as Response; |
| 6 | 6 | use Ps2alerts\Api\Controller\EndpointBaseController; |
| 7 | -use Ps2alerts\Api\QueryObjects\QueryObject; |
|
| 8 | 7 | use Ps2alerts\Api\Loader\ResultLoader; |
| 9 | 8 | use Symfony\Component\HttpFoundation\Request; |
| 10 | 9 | |
@@ -116,7 +116,6 @@ discard block |
||
| 116 | 116 | * Reads all records based off a simple where statement |
| 117 | 117 | * |
| 118 | 118 | * @param array $fields |
| 119 | - * @param string $value |
|
| 120 | 119 | * |
| 121 | 120 | * @return array |
| 122 | 121 | */ |
@@ -136,8 +135,7 @@ discard block |
||
| 136 | 135 | /** |
| 137 | 136 | * Reads the count of records based off a where statement |
| 138 | 137 | * |
| 139 | - * @param array $field |
|
| 140 | - * @param string $value |
|
| 138 | + * @param array $fields |
|
| 141 | 139 | * |
| 142 | 140 | * @return array |
| 143 | 141 | */ |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $key = $this->returnKeyType($keyType); |
| 90 | 90 | |
| 91 | 91 | $query->cols(['*']) |
| 92 | - ->where("`{$key}` = '{$id}'"); |
|
| 92 | + ->where("`{$key}` = '{$id}'"); |
|
| 93 | 93 | |
| 94 | 94 | return $this->fireStatementAndReturn($query, true); |
| 95 | 95 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $key = $this->returnKeyType($keyType); |
| 108 | 108 | |
| 109 | 109 | $query->cols(['*']) |
| 110 | - ->where("`{$key}` = '{$id}'"); |
|
| 110 | + ->where("`{$key}` = '{$id}'"); |
|
| 111 | 111 | |
| 112 | 112 | return $this->fireStatementAndReturn($query); |
| 113 | 113 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | $query->cols(['*']); |
| 128 | 128 | |
| 129 | - foreach($fields as $field => $value) { |
|
| 129 | + foreach ($fields as $field => $value) { |
|
| 130 | 130 | $query->where("`{$field}` = '{$value}'"); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | $query->cols(["COUNT({$key}) as COUNT"]); |
| 150 | 150 | |
| 151 | - foreach($fields as $field => $value) { |
|
| 151 | + foreach ($fields as $field => $value) { |
|
| 152 | 152 | $query->where("`{$field}` = '{$value}'"); |
| 153 | 153 | } |
| 154 | 154 | |