Passed
Push — master ( 481374...e323b6 )
by Henri
01:15
created
src/Validator.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
     public static function checkDatas()
69 69
     {
70
-		self::existData();
70
+        self::existData();
71 71
         self::jsonData();
72 72
         self::hasProvider();
73 73
         self::hasRole();
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
 
84 84
         self::$model = get_class(self::getClass('HnrAzevedo\\Validator\\'.ucfirst(self::$data['provider'])));
85 85
 
86
-		self::existRole(self::$model);
86
+        self::existRole(self::$model);
87 87
             
88
-		foreach ( (self::$validators[self::$model]->getRules($datas['role'])) as $key => $value) {
88
+        foreach ( (self::$validators[self::$model]->getRules($datas['role'])) as $key => $value) {
89 89
             if(@$value['required'] === true){
90 90
                 self::$required[$key] = $value;
91 91
             }
@@ -95,30 +95,30 @@  discard block
 block discarded – undo
95 95
         
96 96
         self::check_requireds();
97 97
 				
98
-		return self::check_errors();
98
+        return self::check_errors();
99 99
     }
100 100
     
101 101
     public static function validate()
102 102
     {
103 103
         foreach ( (self::$validators[self::$model]->getRules(self::$data['role'])) as $key => $value) {
104 104
 
105
-			foreach (json_decode(self::$data['data']) as $keyy => $valuee) {
105
+            foreach (json_decode(self::$data['data']) as $keyy => $valuee) {
106 106
 
107
-				if(!array_key_exists($keyy, (self::$validators[self::$model]->getRules(self::$data['role'])) )){
107
+                if(!array_key_exists($keyy, (self::$validators[self::$model]->getRules(self::$data['role'])) )){
108 108
                     throw new Exception("O campo '{$keyy}' não é esperado para está operação.");
109 109
                 }
110 110
 
111
-				if($keyy===$key){
111
+                if($keyy===$key){
112 112
 
113 113
                     unset(self::$required[$key]);
114 114
 
115
-					foreach ($value as $subkey => $subvalue) {
115
+                    foreach ($value as $subkey => $subvalue) {
116 116
                         $function = "check_{$subkey}";
117 117
                         self::testMethod($function);
118 118
                         self::$function($keyy,$subvalue);
119
-					}
120
-				}
121
-			}
119
+                    }
120
+                }
121
+            }
122 122
         }
123 123
     }
124 124
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 
148 148
         self::existRole(self::$model);
149 149
 
150
-		foreach ( self::$validators[self::$model]->getRules($request['role'])  as $field => $r) {
150
+        foreach ( self::$validators[self::$model]->getRules($request['role'])  as $field => $r) {
151 151
             
152 152
             $response .= ("{$field}:".json_encode(array_reverse($r))).',';
153 153
             
@@ -158,6 +158,6 @@  discard block
 block discarded – undo
158 158
         $response = str_replace('{"','',$response);
159 159
         $response = str_replace('":',':',$response);
160 160
 
161
-		return $response;
162
-	}
161
+        return $response;
162
+    }
163 163
 }
Please login to merge, or discard this patch.
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.