@@ -12,39 +12,39 @@ discard block |
||
| 12 | 12 | * |
| 13 | 13 | * https://www.slimframework.com/docs/objects/router.html#route-strategies |
| 14 | 14 | */ |
| 15 | -$container['foundHandler'] = function () { |
|
| 15 | +$container['foundHandler'] = function() { |
|
| 16 | 16 | return new RequestResponseArgs(); |
| 17 | 17 | }; |
| 18 | 18 | |
| 19 | 19 | if ('prod' === $container['env']) { |
| 20 | - $container['csrfFailureHandler'] = function ($container) { |
|
| 21 | - return function (Request $request, Response $response, callable $next) use ($container) { |
|
| 20 | + $container['csrfFailureHandler'] = function($container) { |
|
| 21 | + return function(Request $request, Response $response, callable $next) use ($container) { |
|
| 22 | 22 | $container['flash']->addMessage('error', 'Failed CSRF check'); |
| 23 | 23 | |
| 24 | 24 | return $response->withRedirect($request->getUri()->getPath()); |
| 25 | 25 | }; |
| 26 | 26 | }; |
| 27 | 27 | |
| 28 | - $container['notFoundHandler'] = function ($container) { |
|
| 29 | - return function (Request $request, Response $response) use ($container) { |
|
| 28 | + $container['notFoundHandler'] = function($container) { |
|
| 29 | + return function(Request $request, Response $response) use ($container) { |
|
| 30 | 30 | return $response->withStatus(404)->write($container['view']->fetch('Error/404.twig')); |
| 31 | 31 | }; |
| 32 | 32 | }; |
| 33 | 33 | |
| 34 | - $container['notAllowedHandler'] = function ($container) { |
|
| 35 | - return function (Request $request, Response $response, array $methods) use ($container) { |
|
| 34 | + $container['notAllowedHandler'] = function($container) { |
|
| 35 | + return function(Request $request, Response $response, array $methods) use ($container) { |
|
| 36 | 36 | return $response->withStatus(405)->write($container['view']->fetch('Error/4xx.twig')); |
| 37 | 37 | }; |
| 38 | 38 | }; |
| 39 | 39 | |
| 40 | - $container['accessDeniedHandler'] = function ($container) { |
|
| 41 | - return function (Request $request, Response $response, Exception $exception) use ($container) { |
|
| 40 | + $container['accessDeniedHandler'] = function($container) { |
|
| 41 | + return function(Request $request, Response $response, Exception $exception) use ($container) { |
|
| 42 | 42 | return $response->withStatus(403)->write($container['view']->fetch('Error/403.twig')); |
| 43 | 43 | }; |
| 44 | 44 | }; |
| 45 | 45 | |
| 46 | - $container['errorHandler'] = function ($container) { |
|
| 47 | - return function (Request $request, Response $response, Exception $exception) use ($container) { |
|
| 46 | + $container['errorHandler'] = function($container) { |
|
| 47 | + return function(Request $request, Response $response, Exception $exception) use ($container) { |
|
| 48 | 48 | if ($exception instanceof AccessDeniedException) { |
| 49 | 49 | return $container['accessDeniedHandler']($request, $response, $exception); |
| 50 | 50 | } |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | }; |
| 54 | 54 | }; |
| 55 | 55 | |
| 56 | - $container['phpErrorHandler'] = function ($container) { |
|
| 57 | - return function (Request $request, Response $response, Throwable $error) use ($container) { |
|
| 56 | + $container['phpErrorHandler'] = function($container) { |
|
| 57 | + return function(Request $request, Response $response, Throwable $error) use ($container) { |
|
| 58 | 58 | return $response->withStatus(500)->write($container['view']->fetch('Error/500.twig')); |
| 59 | 59 | }; |
| 60 | 60 | }; |
@@ -23,21 +23,21 @@ discard block |
||
| 23 | 23 | $capsule->setAsGlobal(); |
| 24 | 24 | $capsule->bootEloquent(); |
| 25 | 25 | |
| 26 | -$container['db'] = function () use ($capsule) { |
|
| 26 | +$container['db'] = function() use ($capsule) { |
|
| 27 | 27 | return $capsule; |
| 28 | 28 | }; |
| 29 | 29 | |
| 30 | -$container['auth'] = function () { |
|
| 30 | +$container['auth'] = function() { |
|
| 31 | 31 | $sentinel = new Sentinel(new SentinelBootstrapper(__DIR__ . '/config/sentinel.php')); |
| 32 | 32 | |
| 33 | 33 | return $sentinel->getSentinel(); |
| 34 | 34 | }; |
| 35 | 35 | |
| 36 | -$container['flash'] = function () { |
|
| 36 | +$container['flash'] = function() { |
|
| 37 | 37 | return new Messages(); |
| 38 | 38 | }; |
| 39 | 39 | |
| 40 | -$container['csrf'] = function ($container) { |
|
| 40 | +$container['csrf'] = function($container) { |
|
| 41 | 41 | $guard = new Guard(); |
| 42 | 42 | if ('prod' === $container['env']) { |
| 43 | 43 | $guard->setFailureCallable($container['csrfFailureHandler']); |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | return $guard; |
| 47 | 47 | }; |
| 48 | 48 | |
| 49 | -$container['validator'] = function () { |
|
| 49 | +$container['validator'] = function() { |
|
| 50 | 50 | return new Validator(); |
| 51 | 51 | }; |
| 52 | 52 | |
| 53 | -$container['view'] = function ($container) { |
|
| 53 | +$container['view'] = function($container) { |
|
| 54 | 54 | $config = $container['config']; |
| 55 | 55 | |
| 56 | 56 | $view = new Twig( |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | return $view; |
| 77 | 77 | }; |
| 78 | 78 | |
| 79 | -$container['monolog'] = function ($container) { |
|
| 79 | +$container['monolog'] = function($container) { |
|
| 80 | 80 | $config = $container['config']['monolog']; |
| 81 | 81 | |
| 82 | 82 | $logger = new Logger($config['name']); |