@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | public function getCacheDir() |
| 39 | 39 | { |
| 40 | - return $this->getRootDir().'/var/cache/'.$this->environment; |
|
| 40 | + return $this->getRootDir() . '/var/cache/' . $this->environment; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function getConfigurationDir() |
| 44 | 44 | { |
| 45 | - return $this->getRootDir().'/config'; |
|
| 45 | + return $this->getRootDir() . '/config'; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | public function getEnvironment() |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | public function getLogDir() |
| 54 | 54 | { |
| 55 | - return $this->getRootDir().'/var/log'; |
|
| 55 | + return $this->getRootDir() . '/var/log'; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public function getRootDir() |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | $settings = $this->readConfigFile('framework.php', ['app' => $this]); |
| 75 | 75 | |
| 76 | - if (file_exists($this->getConfigurationDir().'/services.'.$this->getEnvironment().'.php')) { |
|
| 77 | - $filename = 'services.'.$this->getEnvironment().'.php'; |
|
| 76 | + if (file_exists($this->getConfigurationDir() . '/services.' . $this->getEnvironment() . '.php')) { |
|
| 77 | + $filename = 'services.' . $this->getEnvironment() . '.php'; |
|
| 78 | 78 | } else { |
| 79 | 79 | $filename = 'services.php'; |
| 80 | 80 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $controllers = $this->readConfigFile('controllers.php', ['container' => $container]); |
| 107 | 107 | |
| 108 | 108 | foreach ($controllers as $key => $class) { |
| 109 | - $container['controller.'.$key] = function ($container) use ($class) { |
|
| 109 | + $container['controller.' . $key] = function($container) use ($class) { |
|
| 110 | 110 | return new $class($container); |
| 111 | 111 | }; |
| 112 | 112 | } |
@@ -125,6 +125,6 @@ discard block |
||
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - return require $this->getConfigurationDir().'/'.$filename; |
|
| 128 | + return require $this->getConfigurationDir() . '/' . $filename; |
|
| 129 | 129 | } |
| 130 | 130 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | 'username' => $request->getParam('username'), |
| 22 | 22 | 'password' => $request->getParam('password') |
| 23 | 23 | ]; |
| 24 | - $remember = (bool)$request->getParam('remember'); |
|
| 24 | + $remember = (bool) $request->getParam('remember'); |
|
| 25 | 25 | |
| 26 | 26 | try { |
| 27 | 27 | if ($this->auth->authenticate($credentials, $remember)) { |
@@ -3,12 +3,12 @@ |
||
| 3 | 3 | use App\Middleware\AuthMiddleware; |
| 4 | 4 | use App\Middleware\GuestMiddleware; |
| 5 | 5 | |
| 6 | -$container['middleware.guest'] = function ($container) { |
|
| 6 | +$container['middleware.guest'] = function($container) { |
|
| 7 | 7 | return new GuestMiddleware($container['router'], $container['auth']); |
| 8 | 8 | }; |
| 9 | 9 | |
| 10 | -$container['middleware.auth'] = function ($container) { |
|
| 11 | - return function ($role = null) use ($container) { |
|
| 10 | +$container['middleware.auth'] = function($container) { |
|
| 11 | + return function($role = null) use ($container) { |
|
| 12 | 12 | return new AuthMiddleware($container['router'], $container['flash'], $container['auth'], $role); |
| 13 | 13 | }; |
| 14 | 14 | }; |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | $app->get('/', 'controller.app:home')->setName('home'); |
| 4 | 4 | |
| 5 | -$app->group('', function () { |
|
| 5 | +$app->group('', function() { |
|
| 6 | 6 | $this->map(['GET', 'POST'], '/login', 'controller.auth:login')->setName('login'); |
| 7 | 7 | $this->map(['GET', 'POST'], '/register', 'controller.auth:register')->setName('register'); |
| 8 | 8 | })->add($container['middleware.guest']); |