Passed
Push — master ( 2eee6e...3d96d8 )
by Henri
01:27
created
src/Rules.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,30 +9,30 @@
 block discarded – undo
9 9
 
10 10
     public function __construct(object $model)
11 11
     {
12
-	    $this->form['model'] = ucfirst(get_class($model));
13
-	}
12
+        $this->form['model'] = ucfirst(get_class($model));
13
+    }
14 14
 
15 15
     public function setAction(string $action): Rules
16 16
     {
17
-	    $this->action = $action;
18
-	    return $this;
19
-	}
17
+        $this->action = $action;
18
+        return $this;
19
+    }
20 20
 
21 21
     public function addField(string $field, array $test): Rules
22 22
     {
23
-	    if(empty($this->action)){
23
+        if(empty($this->action)){
24 24
             self::$errors[] = "Form action not registered.";
25 25
         }
26 26
 
27
-	    if(empty($this->form[$this->action][$field])){
27
+        if(empty($this->form[$this->action][$field])){
28 28
             $this->form[$this->action][$field] = $test;
29 29
         }
30 30
 
31
-	    return $this;
32
-  	}
31
+        return $this;
32
+        }
33 33
 
34 34
     public function getRules(string $action): ?array
35 35
     {
36
-		return (array_key_exists($action, $this->form)) ? $this->form[$action] : null;
37
-	}
36
+        return (array_key_exists($action, $this->form)) ? $this->form[$action] : null;
37
+    }
38 38
 }
Please login to merge, or discard this patch.
examples/Rules/User.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,15 +11,15 @@
 block discarded – undo
11 11
     {
12 12
         Validator::add($this, function(Rules $rules){
13 13
             $rules->setAction('login')
14
-                  //->addField('email',['minlength'=>1,'regex'=>'/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/','required'=>true])
15
-                  ->addField('email',['minlength'=>1,'filter'=>FILTER_VALIDATE_EMAIL,'required'=>true])
16
-                  ->addField('password',['minlength'=>6,'maxlength'=>20,'required'=>true])
17
-                  ->addField('password2',['equals'=>'password','required'=>true])
18
-                  ->addField('remember',['minlength'=>2,'maxlength'=>2,'required'=>false])
19
-                  ->addField('birth',['type'=>'date','required'=>true])
20
-                  ->addField('phones',['mincount'=>2,'maxcount'=>3,'required'=>true,'minlength'=>8,'maxlength'=>9]);
14
+                    //->addField('email',['minlength'=>1,'regex'=>'/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/','required'=>true])
15
+                    ->addField('email',['minlength'=>1,'filter'=>FILTER_VALIDATE_EMAIL,'required'=>true])
16
+                    ->addField('password',['minlength'=>6,'maxlength'=>20,'required'=>true])
17
+                    ->addField('password2',['equals'=>'password','required'=>true])
18
+                    ->addField('remember',['minlength'=>2,'maxlength'=>2,'required'=>false])
19
+                    ->addField('birth',['type'=>'date','required'=>true])
20
+                    ->addField('phones',['mincount'=>2,'maxcount'=>3,'required'=>true,'minlength'=>8,'maxlength'=>9]);
21 21
 
22
-			return $rules;
22
+            return $rules;
23 23
         });
24 24
 
25 25
         return $this;
Please login to merge, or discard this patch.