@@ -18,16 +18,16 @@ |
||
| 18 | 18 | Liquid::set('INCLUDE_SUFFIX', 'html'); |
| 19 | 19 | Liquid::set('INCLUDE_PREFIX', ''); |
| 20 | 20 | $path = "app/Views"; |
| 21 | - $template = new Template($path); |
|
| 21 | + $template = new Template($path); |
|
| 22 | 22 | $template->registerFilter(new SiteFilter()); |
| 23 | 23 | |
| 24 | - if(isset($this->custom_filters)){ |
|
| 25 | - foreach($this->custom_filters as $filter){ |
|
| 24 | + if (isset($this->custom_filters)) { |
|
| 25 | + foreach ($this->custom_filters as $filter) { |
|
| 26 | 26 | $template->registerFilter(new $filter()); |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | $template->parseFile($view); |
| 30 | - $parameters = array_map(function ($x) { |
|
| 30 | + $parameters = array_map(function($x) { |
|
| 31 | 31 | if ($x instanceof QuerySet) { |
| 32 | 32 | return $x->do(); |
| 33 | 33 | } else { |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | $template = new Template($path); |
| 22 | 22 | $template->registerFilter(new SiteFilter()); |
| 23 | 23 | |
| 24 | - if(isset($this->custom_filters)){ |
|
| 24 | + if(isset($this->custom_filters)) { |
|
| 25 | 25 | foreach($this->custom_filters as $filter){ |
| 26 | 26 | $template->registerFilter(new $filter()); |
| 27 | 27 | } |
@@ -14,18 +14,17 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | protected function handle(mixed ...$middlewareParams): HttpResponse|Request |
| 16 | 16 | { |
| 17 | - if($this->match instanceof MatchRoute) { |
|
| 17 | + if ($this->match instanceof MatchRoute) { |
|
| 18 | 18 | $reflection = new \ReflectionMethod($this->match->controller, $this->match->method); |
| 19 | 19 | $attributes = $reflection->getAttributes(); |
| 20 | 20 | |
| 21 | 21 | foreach ($attributes as $attribute) { |
| 22 | - if(is_subclass_of($attribute->getName(), AbstractAccessControlAttribute::class)) { |
|
| 22 | + if (is_subclass_of($attribute->getName(), AbstractAccessControlAttribute::class)) { |
|
| 23 | 23 | return |
| 24 | - $this->checkPermissions($attribute->getName(), ...($attribute->getArguments()))? |
|
| 25 | - $this->request : |
|
| 26 | - new RedirectResponse( |
|
| 24 | + $this->checkPermissions($attribute->getName(), ...($attribute->getArguments())) ? |
|
| 25 | + $this->request : new RedirectResponse( |
|
| 27 | 26 | Application::getAuthConfig()->login_url, |
| 28 | - redirect_after: $this->request->url |
|
| 27 | + redirect_after : $this->request->url |
|
| 29 | 28 | ); |
| 30 | 29 | } |
| 31 | 30 | |
@@ -36,7 +35,7 @@ discard block |
||
| 36 | 35 | |
| 37 | 36 | |
| 38 | 37 | protected function checkPermissions(string $modifier, mixed ...$params):bool{ |
| 39 | - if($modifier == LoginRequired::class){ |
|
| 38 | + if ($modifier == LoginRequired::class) { |
|
| 40 | 39 | $authenticator = new \Lepton\Authenticator\UserAuthenticator(); |
| 41 | 40 | return $authenticator->isLoggedIn(); |
| 42 | 41 | } |