Passed
Push — main ( 7f34fc...ff3d68 )
by Roberto
12:26
created
src/Boson/DataTypes/NumberField.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@
 block discarded – undo
3 3
 
4 4
 #[\Attribute]
5 5
 class NumberField extends Field{
6
-  public function __construct(mixed ...$options){
6
+    public function __construct(mixed ...$options){
7 7
     parent::__construct(...$options);
8
-  }
8
+    }
9 9
 
10
-  public function validate($value){
10
+    public function validate($value){
11 11
     if(!is_numeric($value)) return false;
12 12
     return parent::validate($value);
13
-  }
13
+    }
14 14
 }
15 15
\ 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
@@ -2,13 +2,13 @@
 block discarded – undo
2 2
 namespace Lepton\Boson\DataTypes;
3 3
 
4 4
 #[\Attribute]
5
-class NumberField extends Field{
6
-  public function __construct(mixed ...$options){
5
+class NumberField extends Field {
6
+  public function __construct(mixed ...$options) {
7 7
     parent::__construct(...$options);
8 8
   }
9 9
 
10
-  public function validate($value){
11
-    if(!is_numeric($value)) return false;
10
+  public function validate($value) {
11
+    if (!is_numeric($value)) return false;
12 12
     return parent::validate($value);
13 13
   }
14 14
 }
15 15
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@
 block discarded – undo
8 8
   }
9 9
 
10 10
   public function validate($value){
11
-    if(!is_numeric($value)) return false;
11
+    if(!is_numeric($value)) {
12
+        return false;
13
+    }
12 14
     return parent::validate($value);
13 15
   }
14 16
 }
15 17
\ No newline at end of file
Please login to merge, or discard this patch.
src/Boson/DataTypes/PrimaryKey.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@
 block discarded – undo
3 3
 
4 4
 #[\Attribute]
5 5
 class PrimaryKey extends Field{
6
-  public function __construct(mixed ...$options){
6
+    public function __construct(mixed ...$options){
7 7
     $this->null = false;
8 8
     parent::__construct(...$options);
9
-  }
9
+    }
10 10
 
11
-  public function validate($value){
11
+    public function validate($value){
12 12
     if(!is_numeric($value)) return false;
13 13
     return parent::validate($value);
14 14
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,14 +2,14 @@
 block discarded – undo
2 2
 namespace Lepton\Boson\DataTypes;
3 3
 
4 4
 #[\Attribute]
5
-class PrimaryKey extends Field{
6
-  public function __construct(mixed ...$options){
5
+class PrimaryKey extends Field {
6
+  public function __construct(mixed ...$options) {
7 7
     $this->null = false;
8 8
     parent::__construct(...$options);
9 9
   }
10 10
 
11
-  public function validate($value){
12
-    if(!is_numeric($value)) return false;
11
+  public function validate($value) {
12
+    if (!is_numeric($value)) return false;
13 13
     return parent::validate($value);
14 14
 }
15 15
 }
16 16
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,9 @@
 block discarded – undo
9 9
   }
10 10
 
11 11
   public function validate($value){
12
-    if(!is_numeric($value)) return false;
12
+    if(!is_numeric($value)) {
13
+        return false;
14
+    }
13 15
     return parent::validate($value);
14 16
 }
15 17
 }
16 18
\ No newline at end of file
Please login to merge, or discard this patch.
src/Boson/DataTypes/DateTimeField.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@
 block discarded – undo
3 3
 
4 4
 #[\Attribute]
5 5
 class DateTimeField extends Field{
6
-  public function __construct(...$args){
6
+    public function __construct(...$args){
7 7
     parent::__construct(...$args);
8
-  }
8
+    }
9 9
 
10
-  public function validate($value){
10
+    public function validate($value){
11 11
     if (!preg_match("/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/", $value)) return false;
12 12
     return parent::validate($value);
13
-  }
13
+    }
14 14
 }
15 15
\ 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
@@ -2,12 +2,12 @@
 block discarded – undo
2 2
 namespace Lepton\Boson\DataTypes;
3 3
 
4 4
 #[\Attribute]
5
-class DateTimeField extends Field{
6
-  public function __construct(...$args){
5
+class DateTimeField extends Field {
6
+  public function __construct(...$args) {
7 7
     parent::__construct(...$args);
8 8
   }
9 9
 
10
-  public function validate($value){
10
+  public function validate($value) {
11 11
     if (!preg_match("/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/", $value)) return false;
12 12
     return parent::validate($value);
13 13
   }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@
 block discarded – undo
8 8
   }
9 9
 
10 10
   public function validate($value){
11
-    if (!preg_match("/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/", $value)) return false;
11
+    if (!preg_match("/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/", $value)) {
12
+        return false;
13
+    }
12 14
     return parent::validate($value);
13 15
   }
14 16
 }
15 17
\ No newline at end of file
Please login to merge, or discard this patch.
src/Boson/DataTypes/JSONField.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@
 block discarded – undo
5 5
 class JSONField extends Field{
6 6
 
7 7
 
8
-  public function __construct(...$options ){
9
-     parent::__construct(...$options);
8
+    public function __construct(...$options ){
9
+        parent::__construct(...$options);
10 10
 
11
-  }
11
+    }
12 12
 
13
-  public function validate($value){
13
+    public function validate($value){
14 14
     if(!is_array(json_decode($value, true))) return false;
15 15
     return parent::validate($value);
16
-  }
16
+    }
17 17
 }
18 18
\ 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
@@ -2,16 +2,16 @@
 block discarded – undo
2 2
 namespace Lepton\Boson\DataTypes;
3 3
 
4 4
 #[\Attribute]
5
-class JSONField extends Field{
5
+class JSONField extends Field {
6 6
 
7 7
 
8
-  public function __construct(...$options ){
8
+  public function __construct(...$options) {
9 9
      parent::__construct(...$options);
10 10
 
11 11
   }
12 12
 
13
-  public function validate($value){
14
-    if(!is_array(json_decode($value, true))) return false;
13
+  public function validate($value) {
14
+    if (!is_array(json_decode($value, true))) return false;
15 15
     return parent::validate($value);
16 16
   }
17 17
 }
18 18
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,9 @@
 block discarded – undo
11 11
   }
12 12
 
13 13
   public function validate($value){
14
-    if(!is_array(json_decode($value, true))) return false;
14
+    if(!is_array(json_decode($value, true))) {
15
+        return false;
16
+    }
15 17
     return parent::validate($value);
16 18
   }
17 19
 }
18 20
\ No newline at end of file
Please login to merge, or discard this patch.
src/Core/Database.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     {
23 23
         $this->connection = new \mysqli($dbhost, $dbuser, $dbpass, $dbname);
24 24
         if ($this->connection->connect_error) {
25
-            $this->error('Failed to connect to MySQL - ' . $this->connection->connect_error);
25
+            $this->error('Failed to connect to MySQL - '.$this->connection->connect_error);
26 26
         }
27 27
         $this->connection->set_charset($charset);
28 28
     }
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 
49 49
             $this->query->execute();
50 50
             if ($this->query->errno) {
51
-                $this->error('Unable to process MySQL query (check your params) - ' . $this->query->error);
51
+                $this->error('Unable to process MySQL query (check your params) - '.$this->query->error);
52 52
             }
53 53
             $this->query_closed = FALSE;
54 54
         } else {
55
-            $this->error('Unable to prepare MySQL statement (check your syntax) - ' . $this->connection->error);
55
+            $this->error('Unable to prepare MySQL statement (check your syntax) - '.$this->connection->error);
56 56
         }
57 57
         return $this;
58 58
     }
Please login to merge, or discard this patch.
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -76,7 +76,9 @@  discard block
 block discarded – undo
76 76
             }
77 77
             if ($callback != null && is_callable($callback)) {
78 78
                 $value = $callback($r); //call_user_func($callback, $r);
79
-                if ($value == 'break') break;
79
+                if ($value == 'break') {
80
+                    break;
81
+                }
80 82
             } else {
81 83
                 $result[] = $r;
82 84
             }
@@ -141,10 +143,18 @@  discard block
 block discarded – undo
141 143
 
142 144
     private function _gettype($var)
143 145
     {
144
-        if (is_string($var)) return 's';
145
-        if (is_float($var)) return 'd';
146
-        if (is_int($var)) return 'i';
147
-        if (is_null($var)) return 's';
146
+        if (is_string($var)) {
147
+            return 's';
148
+        }
149
+        if (is_float($var)) {
150
+            return 'd';
151
+        }
152
+        if (is_int($var)) {
153
+            return 'i';
154
+        }
155
+        if (is_null($var)) {
156
+            return 's';
157
+        }
148 158
         return 'b';
149 159
     }
150 160
 }
Please login to merge, or discard this patch.
src/Exceptions/MultipleResultsException.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 MultipleResultsException extends Exception{}
7 6
\ No newline at end of file
7
+class MultipleResultsException extends Exception {}
8 8
\ No newline at end of file
Please login to merge, or discard this patch.
src/Middleware/ACFMiddleware.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,18 +22,18 @@
 block discarded – undo
22 22
     protected function checkPermissions(string $modifier, mixed ...$params): bool
23 23
     {
24 24
 
25
-        if($modifier == LoginRequired::class) {
25
+        if ($modifier == LoginRequired::class) {
26 26
             $level = $params[0] ?? 1;
27 27
 
28 28
             $authenticator = new \Lepton\Authenticator\UserAuthenticator();
29 29
             $loggedIn = $authenticator->isLoggedIn();
30
-            if(! $loggedIn) {
30
+            if (!$loggedIn) {
31 31
                 return false;
32 32
             }
33 33
             $user = $authenticator->getLoggedUser();
34 34
             $splitted = explode("__", $this->level_field);
35 35
             $user_level = $user;
36
-            foreach($splitted as $part) {
36
+            foreach ($splitted as $part) {
37 37
                 $user_level = $user_level->$part;
38 38
             }
39 39
             return ($user_level >= $level);
Please login to merge, or discard this patch.
src/Middleware/ConditionalRedirectMiddleware.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
             }
20 20
         }
21 21
         return $this->request;
22
-   }
22
+    }
23 23
 
24 24
     abstract function check_request($middlewareParams);
25 25
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@
 block discarded – undo
11 11
 {
12 12
     protected function handle(mixed ...$middlewareParams): HttpResponse|Request
13 13
     {
14
-        $url = preg_replace("/^" . str_replace("/", "\/", Application::getAppConfig()->base_url) . "\//", "", $this->request->url);
14
+        $url = preg_replace("/^".str_replace("/", "\/", Application::getAppConfig()->base_url)."\//", "", $this->request->url);
15 15
 
16
-        if(!in_array($url, $middlewareParams["allow"])){
17
-            if($this->check_request($middlewareParams)){
16
+        if (!in_array($url, $middlewareParams["allow"])) {
17
+            if ($this->check_request($middlewareParams)) {
18 18
                 return new RedirectResponse($middlewareParams["redirect"], htmx: false, parse: false);
19 19
             }
20 20
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@
 block discarded – undo
13 13
     {
14 14
         $url = preg_replace("/^" . str_replace("/", "\/", Application::getAppConfig()->base_url) . "\//", "", $this->request->url);
15 15
 
16
-        if(!in_array($url, $middlewareParams["allow"])){
17
-            if($this->check_request($middlewareParams)){
16
+        if(!in_array($url, $middlewareParams["allow"])) {
17
+            if($this->check_request($middlewareParams)) {
18 18
                 return new RedirectResponse($middlewareParams["redirect"], htmx: false, parse: false);
19 19
             }
20 20
         }
Please login to merge, or discard this patch.
src/Boson/DataTypes/ForeignKey.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@
 block discarded – undo
14 14
 
15 15
     public function validate($value)
16 16
     {
17
-        if (!is_a($value, $this->parent) && !is_int($value)) return false;
17
+        if (!is_a($value, $this->parent) && !is_int($value)) {
18
+            return false;
19
+        }
18 20
         return parent::validate($value);
19 21
     }
20 22
 }
Please login to merge, or discard this patch.