@@ -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 | ); |
@@ -104,10 +104,10 @@ discard block |
||
| 104 | 104 | * Builds an item response in Fractal then hands off to the responder |
| 105 | 105 | * |
| 106 | 106 | * @param array $item The item to transform |
| 107 | - * @param mixed $callback The Transformer to pass through to Fractal |
|
| 107 | + * @param \League\Fractal\TransformerAbstract $callback The Transformer to pass through to Fractal |
|
| 108 | 108 | * @param \Symfony\Component\HttpFoundation\Response The client's response |
| 109 | 109 | * |
| 110 | - * @return array The formatted array |
|
| 110 | + * @return Response The formatted array |
|
| 111 | 111 | */ |
| 112 | 112 | protected function respondWithItem($item, $callback, Response $response) |
| 113 | 113 | { |
@@ -121,10 +121,10 @@ discard block |
||
| 121 | 121 | * Builds a collection of items from Fractal then hands off to the responder |
| 122 | 122 | * |
| 123 | 123 | * @param array $collection The collection to transform |
| 124 | - * @param mixed $callback The Transformer to pass through to Fractal |
|
| 124 | + * @param \League\Fractal\TransformerAbstract $callback The Transformer to pass through to Fractal |
|
| 125 | 125 | * @param \Symfony\Component\HttpFoundation\Response The client's response |
| 126 | 126 | * |
| 127 | - * @return array The formatted array |
|
| 127 | + * @return Response The formatted array |
|
| 128 | 128 | */ |
| 129 | 129 | protected function respondWithCollection($collection, $callback, Response $response) |
| 130 | 130 | { |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * @param string $message Response message to put in the error |
| 160 | 160 | * @param int $errorCode Error code to set |
| 161 | 161 | * |
| 162 | - * @return array |
|
| 162 | + * @return Response |
|
| 163 | 163 | */ |
| 164 | 164 | protected function respondWithError(Response $response, $message, $errorCode) |
| 165 | 165 | { |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * @param \Symfony\Component\HttpFoundation\Response $response |
| 187 | 187 | * @param string $message |
| 188 | 188 | * |
| 189 | - * @return void |
|
| 189 | + * @return Response |
|
| 190 | 190 | */ |
| 191 | 191 | public function errorEmpty(Response $response, $message = 'No data / Empty') |
| 192 | 192 | { |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | * @param \Symfony\Component\HttpFoundation\Response $response |
| 201 | 201 | * @param string $message |
| 202 | 202 | * |
| 203 | - * @return void |
|
| 203 | + * @return Response |
|
| 204 | 204 | */ |
| 205 | 205 | public function errorForbidden(Response $response, $message = 'Forbidden') |
| 206 | 206 | { |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * @param \Symfony\Component\HttpFoundation\Response $response |
| 215 | 215 | * @param string $message |
| 216 | 216 | * |
| 217 | - * @return void |
|
| 217 | + * @return Response |
|
| 218 | 218 | */ |
| 219 | 219 | public function errorInternalError(Response $response, $message = 'Internal Error') |
| 220 | 220 | { |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | * @param \Symfony\Component\HttpFoundation\Response $response |
| 229 | 229 | * @param string $message |
| 230 | 230 | * |
| 231 | - * @return void |
|
| 231 | + * @return Response |
|
| 232 | 232 | */ |
| 233 | 233 | public function errorNotFound(Response $response, $message = 'Resource Not Found') |
| 234 | 234 | { |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | * @param \Symfony\Component\HttpFoundation\Response $response |
| 243 | 243 | * @param string $message |
| 244 | 244 | * |
| 245 | - * @return void |
|
| 245 | + * @return Response |
|
| 246 | 246 | */ |
| 247 | 247 | public function errorUnauthorized(Response $response, $message = 'Unauthorized') |
| 248 | 248 | { |
@@ -272,7 +272,7 @@ |
||
| 272 | 272 | { |
| 273 | 273 | $queryString = $request->query->get('embed'); |
| 274 | 274 | |
| 275 | - if (! empty($queryString)) { |
|
| 275 | + if (!empty($queryString)) { |
|
| 276 | 276 | $this->fractal->parseIncludes($request->query->get('embed')); |
| 277 | 277 | } |
| 278 | 278 | } |