@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | $container = $app->getContainer(); |
8 | 8 | |
9 | 9 | // Twig renderer |
10 | -$container['view'] = function ($c) { |
|
10 | +$container['view'] = function($c) { |
|
11 | 11 | $settings = $c->get('settings')['twig']; |
12 | 12 | |
13 | 13 | $view = new \Slim\Views\Twig($settings['template_path'], [ |
@@ -38,43 +38,43 @@ discard block |
||
38 | 38 | $capsule->setAsGlobal(); |
39 | 39 | $capsule->bootEloquent(); |
40 | 40 | |
41 | -$container['db'] = function ($c) { |
|
41 | +$container['db'] = function($c) { |
|
42 | 42 | return $capsule; |
43 | 43 | }; |
44 | 44 | |
45 | 45 | // Controllers |
46 | 46 | |
47 | -$container['IndexController'] = function ($c) { |
|
47 | +$container['IndexController'] = function($c) { |
|
48 | 48 | return new \App\Controllers\IndexController($c); |
49 | 49 | }; |
50 | 50 | |
51 | -$container['ErrorController'] = function ($c) { |
|
51 | +$container['ErrorController'] = function($c) { |
|
52 | 52 | return new \App\Controllers\ErrorController($c); |
53 | 53 | }; |
54 | 54 | |
55 | -$container['AuthController'] = function ($c) { |
|
55 | +$container['AuthController'] = function($c) { |
|
56 | 56 | return new \App\Controllers\Auth\AuthController($c); |
57 | 57 | }; |
58 | 58 | |
59 | -$container['PasswordController'] = function ($c) { |
|
59 | +$container['PasswordController'] = function($c) { |
|
60 | 60 | return new \App\Controllers\Auth\PasswordController($c); |
61 | 61 | }; |
62 | 62 | |
63 | 63 | // Addons |
64 | 64 | |
65 | -$container['validator'] = function ($c) { |
|
65 | +$container['validator'] = function($c) { |
|
66 | 66 | return new \App\Validation\Validator; |
67 | 67 | }; |
68 | 68 | |
69 | -$container['csrf'] = function ($c) { |
|
69 | +$container['csrf'] = function($c) { |
|
70 | 70 | $guard = new \Slim\Csrf\Guard; |
71 | 71 | return $guard->setFailureCallable(new \App\Middleware\FormsMiddleware\CsrfErrorMiddleware($c)); |
72 | 72 | }; |
73 | 73 | |
74 | -$container['flash'] = function ($c) { |
|
74 | +$container['flash'] = function($c) { |
|
75 | 75 | return new \Slim\Flash\Messages; |
76 | 76 | }; |
77 | 77 | |
78 | -$container['auth'] = function ($c) { |
|
78 | +$container['auth'] = function($c) { |
|
79 | 79 | return new \App\Auth\Auth; |
80 | 80 | }; |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | $app->get('/err', 'ErrorController:index')->setName('err'); |
9 | 9 | |
10 | 10 | // Guest access routes |
11 | -$app->group('', function () { |
|
11 | +$app->group('', function() { |
|
12 | 12 | // Sign up |
13 | 13 | $this->get('/auth/signup', 'AuthController:getSignUp')->setName('auth.signup'); |
14 | 14 | $this->post('/auth/signup', 'AuthController:postSignUp'); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | })->add(new GuestMiddleware($container)); |
20 | 20 | |
21 | 21 | // User access routes |
22 | -$app->group('', function () { |
|
22 | +$app->group('', function() { |
|
23 | 23 | // Logout |
24 | 24 | $this->get('/auth/signout', 'AuthController:getSignOut')->setName('auth.signout'); |
25 | 25 |
@@ -11,11 +11,11 @@ |
||
11 | 11 | $this->container->view->getEnvironment()->addGlobal('csrf', [ |
12 | 12 | 'field' => ' |
13 | 13 | <input type="hidden" |
14 | - name="'.$this->container->csrf->getTokenNameKey() . '" |
|
15 | - value="'.$this->container->csrf->getTokenName() . '"> |
|
14 | + name="'.$this->container->csrf->getTokenNameKey().'" |
|
15 | + value="'.$this->container->csrf->getTokenName().'"> |
|
16 | 16 | <input type="hidden" |
17 | - name="'.$this->container->csrf->getTokenValueKey() . '" |
|
18 | - value="'.$this->container->csrf->getTokenValue() . '"> |
|
17 | + name="'.$this->container->csrf->getTokenValueKey().'" |
|
18 | + value="'.$this->container->csrf->getTokenValue().'"> |
|
19 | 19 | ', |
20 | 20 | ]); |
21 | 21 |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | // Twig renderer |
8 | 8 | 'twig' => [ |
9 | - 'template_path' => __DIR__ . '\..\resources\views', |
|
9 | + 'template_path' => __DIR__.'\..\resources\views', |
|
10 | 10 | 'cache' => false, |
11 | 11 | ], |
12 | 12 |
@@ -3,28 +3,28 @@ |
||
3 | 3 | // To help the built-in PHP dev server, check if the request was actually for |
4 | 4 | // something which should probably be served as a static file |
5 | 5 | $url = parse_url($_SERVER['REQUEST_URI']); |
6 | - $file = __DIR__ . $url['path']; |
|
6 | + $file = __DIR__.$url['path']; |
|
7 | 7 | if (is_file($file)) { |
8 | 8 | return false; |
9 | 9 | } |
10 | 10 | } |
11 | 11 | |
12 | -require __DIR__ . '/../vendor/autoload.php'; |
|
12 | +require __DIR__.'/../vendor/autoload.php'; |
|
13 | 13 | |
14 | 14 | session_start(); |
15 | 15 | |
16 | 16 | // Instantiate the app |
17 | -$settings = require __DIR__ . '/../src/settings.php'; |
|
17 | +$settings = require __DIR__.'/../src/settings.php'; |
|
18 | 18 | $app = new \Slim\App($settings); |
19 | 19 | |
20 | 20 | // Set up dependencies |
21 | -require __DIR__ . '/../src/dependencies.php'; |
|
21 | +require __DIR__.'/../src/dependencies.php'; |
|
22 | 22 | |
23 | 23 | // Register middleware |
24 | -require __DIR__ . '/../src/middleware.php'; |
|
24 | +require __DIR__.'/../src/middleware.php'; |
|
25 | 25 | |
26 | 26 | // Register routes |
27 | -require __DIR__ . '/../src/routes.php'; |
|
27 | +require __DIR__.'/../src/routes.php'; |
|
28 | 28 | |
29 | 29 | // Run app |
30 | 30 | $app->run(); |