Passed
Push — main ( 180138...a48f4d )
by Roberto
02:03 queued 13s
created
src/Authenticator/UserAuthenticator.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 
89 89
 
90 90
 
91
-    public function register($username, $password=null, $level=1)
91
+    public function register($username, $password = null, $level = 1)
92 92
     {
93 93
         // Check if username is already taken
94 94
         if ($this->getUserByUsername($username)) {
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         }
97 97
 
98 98
         // Hash the password
99
-        if (! $password) {
99
+        if (!$password) {
100 100
             $password = $this->randomPassword(length: 5);
101 101
         }
102 102
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,8 @@
 block discarded – undo
67 67
         $user = $this->getUserById($user_id);
68 68
 
69 69
         //$hashField = $this->config->hash_field;
70
-        if (!$user) {// || $user->$hashField !== $_SESSION['session_hash']) {
70
+        if (!$user) {
71
+// || $user->$hashField !== $_SESSION['session_hash']) {
71 72
             return false;
72 73
         }
73 74
 
Please login to merge, or discard this patch.
src/Middleware/BaseAccessControlMiddleware.php 2 patches
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,18 +14,17 @@  discard block
 block discarded – undo
14 14
     protected function handle(mixed ...$params): HttpResponse|Request
15 15
     {
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
 
37 37
 
38 38
     protected function checkPermissions(string $modifier, mixed ...$params):bool{
39
-        if($modifier == LoginRequired::class){
39
+        if($modifier == LoginRequired::class) {
40 40
             $authenticator = new \Lepton\Authenticator\UserAuthenticator();
41 41
             return $authenticator->isLoggedIn();
42 42
         }
Please login to merge, or discard this patch.
src/Middleware/ACFMiddleware.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 use \Lepton\Http\Response\{SuccessResponse, HttpResponse, RedirectResponse};
8 8
 
9 9
 
10
-class ACFMiddleware extends BaseAccessControlMiddleware{
10
+class ACFMiddleware extends BaseAccessControlMiddleware {
11 11
 
12 12
     protected function checkPermissions(string $modifier, mixed ...$params):bool{
13 13
 
Please login to merge, or discard this patch.
src/Middleware/AbstractMiddleware.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,22 +10,22 @@
 block discarded – undo
10 10
 
11 11
 abstract class AbstractMiddleware{
12 12
 
13
-  public BaseMatch $match;
14
-  public Request $request;
13
+    public BaseMatch $match;
14
+    public Request $request;
15 15
 
16
-  public function __construct(){  }
16
+    public function __construct(){  }
17 17
 
18
-  abstract protected function handle(mixed ...$args): HttpResponse|Request;
18
+    abstract protected function handle(mixed ...$args): HttpResponse|Request;
19 19
 
20
-  public function addMatcher(BaseMatch $match){
20
+    public function addMatcher(BaseMatch $match){
21 21
     $this->match = $match;
22
-  }
22
+    }
23 23
 
24
-  public function setRequest(Request $request){
24
+    public function setRequest(Request $request){
25 25
     $this->request = $request;
26
-  }
26
+    }
27 27
 
28
-  public function __invoke(mixed ...$args) {
28
+    public function __invoke(mixed ...$args) {
29 29
         return $this->handle(...$args);
30 30
     }
31 31
 }
32 32
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,20 +8,20 @@
 block discarded – undo
8 8
 
9 9
 // Abstract Middleware to be used in Routing
10 10
 
11
-abstract class AbstractMiddleware{
11
+abstract class AbstractMiddleware {
12 12
 
13 13
   public BaseMatch $match;
14 14
   public Request $request;
15 15
 
16
-  public function __construct(){  }
16
+  public function __construct() {  }
17 17
 
18 18
   abstract protected function handle(mixed ...$args): HttpResponse|Request;
19 19
 
20
-  public function addMatcher(BaseMatch $match){
20
+  public function addMatcher(BaseMatch $match) {
21 21
     $this->match = $match;
22 22
   }
23 23
 
24
-  public function setRequest(Request $request){
24
+  public function setRequest(Request $request) {
25 25
     $this->request = $request;
26 26
   }
27 27
 
Please login to merge, or discard this patch.
src/Exceptions/ControllerNotFoundException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,4 +3,4 @@
 block discarded – undo
3 3
 
4 4
 use Exception;
5 5
 
6
-class ControllerNotFoundException extends Exception{}
7 6
\ No newline at end of file
7
+class ControllerNotFoundException extends Exception {}
8 8
\ No newline at end of file
Please login to merge, or discard this patch.
src/Exceptions/TableNameNotSetException.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 
6 6
 class TableNameNotSetException extends Exception{
7 7
 
8
-  public function __construct(\ReflectionClass $class, $message = "", $code = 0, ?\Throwable $previous = null){
8
+    public function __construct(\ReflectionClass $class, $message = "", $code = 0, ?\Throwable $previous = null){
9 9
 
10 10
     $className = $class->getName();
11 11
 
@@ -15,5 +15,5 @@  discard block
 block discarded – undo
15 15
     $this->line = $class->getStartLine();
16 16
     $this->file = $class->getFileName();
17 17
     parent::__construct($message, $code, $previous);
18
-  }
18
+    }
19 19
 }
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@
 block discarded – undo
3 3
 
4 4
 use Exception;
5 5
 
6
-class TableNameNotSetException extends Exception{
6
+class TableNameNotSetException extends Exception {
7 7
 
8
-  public function __construct(\ReflectionClass $class, $message = "", $code = 0, ?\Throwable $previous = null){
8
+  public function __construct(\ReflectionClass $class, $message = "", $code = 0, ?\Throwable $previous = null) {
9 9
 
10 10
     $className = $class->getName();
11 11
 
12
-    $message =  "No Table Name: ".
12
+    $message = "No Table Name: ".
13 13
                 "Model '$className' has no table name set.";
14 14
 
15 15
     $this->line = $class->getStartLine();
Please login to merge, or discard this patch.
src/Exceptions/MultipleFieldAttributeException.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 
8 8
 class MultipleFieldAttributeException extends FieldException{
9 9
 
10
-  public function __construct(\ReflectionProperty $prop, $message = "Lo", $code = 0, ?\Throwable $previous = null){
10
+    public function __construct(\ReflectionProperty $prop, $message = "Lo", $code = 0, ?\Throwable $previous = null){
11 11
 
12 12
     $propName = $prop->getName();
13 13
     $className = $prop->getDeclaringClass()->getName();
@@ -16,5 +16,5 @@  discard block
 block discarded – undo
16 16
                 "Field '$propName' of '$className' has more than one Field Attribute.";
17 17
 
18 18
     parent::__construct($prop, $message, $code, $previous);
19
-  }
19
+    }
20 20
 }
21 21
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@
 block discarded – undo
5 5
 use Throwable;
6 6
 use Lepton\Helpers\Functions;
7 7
 
8
-class MultipleFieldAttributeException extends FieldException{
8
+class MultipleFieldAttributeException extends FieldException {
9 9
 
10
-  public function __construct(\ReflectionProperty $prop, $message = "Lo", $code = 0, ?\Throwable $previous = null){
10
+  public function __construct(\ReflectionProperty $prop, $message = "Lo", $code = 0, ?\Throwable $previous = null) {
11 11
 
12 12
     $propName = $prop->getName();
13 13
     $className = $prop->getDeclaringClass()->getName();
14 14
 
15
-    $message =  "Multiple Field attributes: ".
15
+    $message = "Multiple Field attributes: ".
16 16
                 "Field '$propName' of '$className' has more than one Field Attribute.";
17 17
 
18 18
     parent::__construct($prop, $message, $code, $previous);
Please login to merge, or discard this patch.
src/Exceptions/InvalidFieldException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,4 +3,4 @@
 block discarded – undo
3 3
 
4 4
 use Exception;
5 5
 
6
-class InvalidFieldException extends Exception{}
7 6
\ No newline at end of file
7
+class InvalidFieldException extends Exception {}
8 8
\ No newline at end of file
Please login to merge, or discard this patch.
src/Exceptions/MultiplePrimaryKeyException.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 
8 8
 class MultiplePrimaryKeyException extends FieldException{
9 9
 
10
-  public function __construct(\ReflectionProperty $prop, $message = "Lo", $code = 0, ?\Throwable $previous = null){
10
+    public function __construct(\ReflectionProperty $prop, $message = "Lo", $code = 0, ?\Throwable $previous = null){
11 11
 
12 12
     $propName = $prop->getName();
13 13
     $className = $prop->getDeclaringClass()->getName();
@@ -16,5 +16,5 @@  discard block
 block discarded – undo
16 16
                 "Field '$propName' of '$className' has more than one Primary Key.";
17 17
 
18 18
     parent::__construct($prop, $message, $code, $previous);
19
-  }
19
+    }
20 20
 }
21 21
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@
 block discarded – undo
5 5
 use Throwable;
6 6
 use Lepton\Helpers\Functions;
7 7
 
8
-class MultiplePrimaryKeyException extends FieldException{
8
+class MultiplePrimaryKeyException extends FieldException {
9 9
 
10
-  public function __construct(\ReflectionProperty $prop, $message = "Lo", $code = 0, ?\Throwable $previous = null){
10
+  public function __construct(\ReflectionProperty $prop, $message = "Lo", $code = 0, ?\Throwable $previous = null) {
11 11
 
12 12
     $propName = $prop->getName();
13 13
     $className = $prop->getDeclaringClass()->getName();
14 14
 
15
-    $message =  "Multiple PrimaryKey: ".
15
+    $message = "Multiple PrimaryKey: ".
16 16
                 "Field '$propName' of '$className' has more than one Primary Key.";
17 17
 
18 18
     parent::__construct($prop, $message, $code, $previous);
Please login to merge, or discard this patch.