Completed
Push — master ( e95e41...a095e7 )
by Alessandro
02:03
created
src/Validoo/Validator.php 1 patch
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -52,14 +52,17 @@  discard block
 block discarded – undo
52 52
         $errors = null;
53 53
         foreach ($rules as $input => $input_rules) {
54 54
 
55
-            if (is_string($input_rules))
56
-                $input_rules = explode("|", $input_rules);
55
+            if (is_string($input_rules)) {
56
+                            $input_rules = explode("|", $input_rules);
57
+            }
57 58
 
58
-            if (!is_array($input_rules))
59
-                throw new ValidooException(ValidooException::ARRAY_EXPECTED, $input);
59
+            if (!is_array($input_rules)) {
60
+                            throw new ValidooException(ValidooException::ARRAY_EXPECTED, $input);
61
+            }
60 62
 
61
-            if (in_array("onlyifset", $input_rules) && !isset($inputs[$input]))
62
-                continue;
63
+            if (in_array("onlyifset", $input_rules) && !isset($inputs[$input])) {
64
+                            continue;
65
+            }
63 66
 
64 67
             foreach ($input_rules as $rule => $closure) {
65 68
                 if (!isset($inputs[$input])) {
@@ -70,8 +73,9 @@  discard block
 block discarded – undo
70 73
                 if (is_numeric($rule)) {
71 74
                     $rule = $closure;
72 75
                 }
73
-                if ('onlyifset' == $rule)
74
-                    continue;
76
+                if ('onlyifset' == $rule) {
77
+                                    continue;
78
+                }
75 79
 
76 80
                 $rule_and_params = self::getParams($rule);
77 81
                 $params = $real_params = $rule_and_params['params'];
@@ -157,10 +161,12 @@  discard block
 block discarded – undo
157 161
      */
158 162
     protected static function required($input = null): bool
159 163
     {
160
-        if (is_string($input))
161
-            $input = trim($input);
162
-        if (is_numeric($input))
163
-            return true;
164
+        if (is_string($input)) {
165
+                    $input = trim($input);
166
+        }
167
+        if (is_numeric($input)) {
168
+                    return true;
169
+        }
164 170
 
165 171
         return (null !== $input && !empty($input));
166 172
     }
Please login to merge, or discard this patch.