@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | * |
16 | 16 | * https://www.slimframework.com/docs/objects/router.html#route-strategies |
17 | 17 | */ |
18 | -$container['foundHandler'] = function () { |
|
18 | +$container['foundHandler'] = function() { |
|
19 | 19 | return new RequestResponseArgs(); |
20 | 20 | }; |
21 | 21 | |
22 | -$container['csrfFailureHandler'] = function ($container) { |
|
23 | - return function (Request $request, Response $response, callable $next) use ($container) { |
|
22 | +$container['csrfFailureHandler'] = function($container) { |
|
23 | + return function(Request $request, Response $response, callable $next) use ($container) { |
|
24 | 24 | $container['monolog']->error(sprintf('Failed CSRF check on "%s /%s"', $request->getMethod(), $request->getUri()->getPath())); |
25 | 25 | |
26 | 26 | $container['flash']->addMessage('error', 'Failed CSRF check'); |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | }; |
34 | 34 | }; |
35 | 35 | |
36 | -$container['notFoundHandler'] = function ($container) { |
|
37 | - return function (Request $request, Response $response) use ($container) { |
|
36 | +$container['notFoundHandler'] = function($container) { |
|
37 | + return function(Request $request, Response $response) use ($container) { |
|
38 | 38 | $container['monolog']->error(sprintf('No route found for "%s /%s"', $request->getMethod(), $request->getUri()->getPath())); |
39 | 39 | |
40 | 40 | if ('prod' === $container['env']) { |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | }; |
46 | 46 | }; |
47 | 47 | |
48 | -$container['notAllowedHandler'] = function ($container) { |
|
49 | - return function (Request $request, Response $response, array $methods) use ($container) { |
|
48 | +$container['notAllowedHandler'] = function($container) { |
|
49 | + return function(Request $request, Response $response, array $methods) use ($container) { |
|
50 | 50 | $container['monolog']->error(sprintf( |
51 | 51 | 'No route found for "%s /%s": Method not allowed (Allow: %s)', |
52 | 52 | $request->getMethod(), |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | }; |
63 | 63 | }; |
64 | 64 | |
65 | -$container['accessDeniedHandler'] = function ($container) { |
|
66 | - return function (Request $request, Response $response, AccessDeniedException $exception) use ($container) { |
|
65 | +$container['accessDeniedHandler'] = function($container) { |
|
66 | + return function(Request $request, Response $response, AccessDeniedException $exception) use ($container) { |
|
67 | 67 | $container['monolog']->debug('Access denied, the user does not have access to this section', [ |
68 | 68 | 'exception' => $exception |
69 | 69 | ]); |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | }; |
73 | 73 | }; |
74 | 74 | |
75 | -$container['errorHandler'] = function ($container) { |
|
76 | - return function (Request $request, Response $response, Exception $exception) use ($container) { |
|
75 | +$container['errorHandler'] = function($container) { |
|
76 | + return function(Request $request, Response $response, Exception $exception) use ($container) { |
|
77 | 77 | if ($exception instanceof AccessDeniedException) { |
78 | 78 | return $container['accessDeniedHandler']($request, $response, $exception); |
79 | 79 | } |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | }; |
91 | 91 | }; |
92 | 92 | |
93 | -$container['phpErrorHandler'] = function ($container) { |
|
94 | - return function (Request $request, Response $response, Throwable $error) use ($container) { |
|
93 | +$container['phpErrorHandler'] = function($container) { |
|
94 | + return function(Request $request, Response $response, Throwable $error) use ($container) { |
|
95 | 95 | $container['monolog']->critical('Uncaught PHP Exception ' . get_class($error), [ |
96 | 96 | 'exception' => $error |
97 | 97 | ]); |
@@ -23,32 +23,32 @@ 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 | $guard->setFailureCallable($container['csrfFailureHandler']); |
43 | 43 | |
44 | 44 | return $guard; |
45 | 45 | }; |
46 | 46 | |
47 | -$container['validator'] = function () { |
|
47 | +$container['validator'] = function() { |
|
48 | 48 | return new Validator(); |
49 | 49 | }; |
50 | 50 | |
51 | -$container['view'] = function ($container) { |
|
51 | +$container['view'] = function($container) { |
|
52 | 52 | $config = $container['config']; |
53 | 53 | |
54 | 54 | $view = new Twig( |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | return $view; |
75 | 75 | }; |
76 | 76 | |
77 | -$container['monolog'] = function ($container) { |
|
77 | +$container['monolog'] = function($container) { |
|
78 | 78 | $config = $container['config']['monolog']; |
79 | 79 | |
80 | 80 | $logger = new Logger($config['name']); |