Passed
Push — master ( 42c6c4...6eb781 )
by Henri
06:37
created
src/Validator.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
             self::getInstance()->errors[] = $er->getMessage();
89 89
         }
90 90
         
91
-		return self::errors();
91
+        return self::errors();
92 92
     }
93 93
 
94 94
     public static function errors(): bool
@@ -100,22 +100,22 @@  discard block
 block discarded – undo
100 100
     {
101 101
         foreach ( (self::getInstance()->validator(self::getInstance()->model)->getRules(self::getInstance()->data['_ROLE'])) as $key => $value) {
102 102
 
103
-			foreach (self::getInstance()->data as $keyy => $valuee) {
103
+            foreach (self::getInstance()->data as $keyy => $valuee) {
104 104
 
105
-				self::getInstance()->checkExpected($keyy);
105
+                self::getInstance()->checkExpected($keyy);
106 106
 
107
-				if($keyy===$key){
107
+                if($keyy===$key){
108 108
 
109 109
                     unset(self::getInstance()->required[$key]);
110 110
 
111
-					foreach ($value as $subkey => $subvalue) {
111
+                    foreach ($value as $subkey => $subvalue) {
112 112
 
113 113
                         $function = strtolower($subkey);
114 114
 
115 115
                         self::getInstance()->hasMethod($function)->$function($keyy, $subvalue);
116
-					}
117
-				}
118
-			}
116
+                    }
117
+                }
118
+            }
119 119
         }
120 120
     }
121 121
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
         self::getInstance()->existRole(self::getInstance()->model());
157 157
 
158
-		foreach ( self::getInstance()->validator(self::getInstance()->model())->getRules($request['_ROLE'])  as $field => $r) {
158
+        foreach ( self::getInstance()->validator(self::getInstance()->model())->getRules($request['_ROLE'])  as $field => $r) {
159 159
             $r = self::getInstance()->replaceRegex($r);
160 160
             $response .= ("'$field':".json_encode(array_reverse($r))).',';
161 161
         }
Please login to merge, or discard this patch.
src/Rules.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,29 +12,29 @@
 block discarded – undo
12 12
 
13 13
     public function __construct(object $model)
14 14
     {
15
-	    $this->form['model'] = ucfirst(get_class($model));
16
-	}
15
+        $this->form['model'] = ucfirst(get_class($model));
16
+    }
17 17
 
18 18
     public function action(string $action): Rules
19 19
     {
20
-	    $this->action = $action;
21
-	    return $this;
22
-	}
20
+        $this->action = $action;
21
+        return $this;
22
+    }
23 23
 
24 24
     public function field(string $field, array $test, ?string $placeholder = null): Rules
25 25
     {
26
-	    if(empty($this->action)){
26
+        if(empty($this->action)){
27 27
             self::$errors[] = self::$err['nFoundForm'];
28 28
             return $this;
29 29
         }
30 30
 
31 31
         $this->form[$this->action][$field] = $test;
32 32
         $this->form[$this->action][$field]['placeholder'] = (null !== $placeholder) ? $placeholder : $test;
33
-	    return $this;
34
-  	}
33
+        return $this;
34
+        }
35 35
 
36 36
     public function getRules(string $action): Array
37 37
     {
38
-		return (array_key_exists($action, $this->form)) ? $this->form[$action] : [];
39
-	}
38
+        return (array_key_exists($action, $this->form)) ? $this->form[$action] : [];
39
+    }
40 40
 }
Please login to merge, or discard this patch.
examples/Rules/User.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,19 +11,19 @@
 block discarded – undo
11 11
     {
12 12
         Validator::add($this, function(Rules $rules){
13 13
             $rules->action('login')
14
-                  ->field('email',[
15
-                      'minlength' => 1,
16
-                      'filter' => FILTER_VALIDATE_EMAIL,
17
-                      'regex' => '/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/',
18
-                      'required' => true
19
-                  ], 'Email address')
20
-                  ->field('password',['minlength'=>6,'maxlength'=>20,'required'=>true])
21
-                  ->field('password2',['minlength'=>6,'maxlength'=>20,'equals'=>'password','required'=>true])
22
-                  ->field('remember',['minlength'=>2,'maxlength'=>2,'required'=>false])
23
-                  ->field('birth',['type'=>'date','required'=>true])
24
-                  ->field('phones',['mincount'=>2,'maxcount'=>3,'required'=>true,'minlength'=>8,'maxlength'=>9]);
14
+                    ->field('email',[
15
+                        'minlength' => 1,
16
+                        'filter' => FILTER_VALIDATE_EMAIL,
17
+                        'regex' => '/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/',
18
+                        'required' => true
19
+                    ], 'Email address')
20
+                    ->field('password',['minlength'=>6,'maxlength'=>20,'required'=>true])
21
+                    ->field('password2',['minlength'=>6,'maxlength'=>20,'equals'=>'password','required'=>true])
22
+                    ->field('remember',['minlength'=>2,'maxlength'=>2,'required'=>false])
23
+                    ->field('birth',['type'=>'date','required'=>true])
24
+                    ->field('phones',['mincount'=>2,'maxcount'=>3,'required'=>true,'minlength'=>8,'maxlength'=>9]);
25 25
 
26
-			return $rules;
26
+            return $rules;
27 27
         });
28 28
 
29 29
         return $this;
Please login to merge, or discard this patch.