Completed
Pull Request — master (#1)
by Alessandro
08:41
created
src/Validoo/Validator.php 1 patch
Braces   +22 added lines, -16 removed lines patch added patch discarded remove patch
@@ -101,8 +101,9 @@  discard block
 block discarded – undo
101 101
     {
102 102
         /* handle error text file for custom validators */
103 103
         $custom_error_texts = [];
104
-        if (file_exists($this->getErrorFilePath($lang)))
105
-            $custom_error_texts = include($this->getErrorFilePath($lang));
104
+        if (file_exists($this->getErrorFilePath($lang))) {
105
+                    $custom_error_texts = include($this->getErrorFilePath($lang));
106
+        }
106 107
         return $custom_error_texts;
107 108
     }
108 109
 
@@ -128,10 +129,11 @@  discard block
 block discarded – undo
128 129
     {
129 130
         foreach ($params as $key => $param) {
130 131
             if (preg_match("#^:([a-zA-Z0-9_]+)$#", $param, $param_type)) {
131
-                if (isset($this->namings[(string)$param_type[1]]))
132
-                    $params[$key] = $this->namings[(string)$param_type[1]];
133
-                else
134
-                    $params[$key] = $param_type[1];
132
+                if (isset($this->namings[(string)$param_type[1]])) {
133
+                                    $params[$key] = $this->namings[(string)$param_type[1]];
134
+                } else {
135
+                                    $params[$key] = $param_type[1];
136
+                }
135 137
             }
136 138
         }
137 139
         return $params;
@@ -144,8 +146,9 @@  discard block
 block discarded – undo
144 146
      */
145 147
     public function getErrors(string $lang = null): array
146 148
     {
147
-        if ($lang == null)
148
-            $lang = $this->getDefaultLang();
149
+        if ($lang == null) {
150
+                    $lang = $this->getDefaultLang();
151
+        }
149 152
 
150 153
         $error_results = [];
151 154
         $default_error_texts = $this->getDefaultErrorTexts($lang);
@@ -175,9 +178,10 @@  discard block
 block discarded – undo
175 178
                 /**
176 179
                  * handle :params(..)
177 180
                  */
178
-                if (preg_match_all("#:params\((.+?)\)#", $error_message, $param_indexes))
179
-                    foreach ($param_indexes[1] as $param_index) {
181
+                if (preg_match_all("#:params\((.+?)\)#", $error_message, $param_indexes)) {
182
+                                    foreach ($param_indexes[1] as $param_index) {
180 183
                         $error_message = str_replace(":params(" . $param_index . ")", $result['params'][$param_index], $error_message);
184
+                }
181 185
                     }
182 186
                 $error_results[] = str_replace(":attribute", $named_input, $error_message);
183 187
             }
@@ -192,8 +196,9 @@  discard block
 block discarded – undo
192 196
      */
193 197
     public function has(string $input_name, string $rule_name = null): bool
194 198
     {
195
-        if ($rule_name != null)
196
-            return isset($this->errors[$input_name][$rule_name]);
199
+        if ($rule_name != null) {
200
+                    return isset($this->errors[$input_name][$rule_name]);
201
+        }
197 202
         return isset($this->errors[$input_name]);
198 203
     }
199 204
 
@@ -253,10 +258,11 @@  discard block
 block discarded – undo
253 258
         foreach ($rules as $input => $input_rules) {
254 259
             if (is_array($input_rules)) {
255 260
                 foreach ($input_rules as $rule => $closure) {
256
-                    if (!isset($inputs[(string)$input]))
257
-                        $input_value = null;
258
-                    else
259
-                        $input_value = $inputs[(string)$input];
261
+                    if (!isset($inputs[(string)$input])) {
262
+                                            $input_value = null;
263
+                    } else {
264
+                                            $input_value = $inputs[(string)$input];
265
+                    }
260 266
                     /**
261 267
                      * if the key of the $input_rules is numeric that means
262 268
                      * it's neither an anonymous nor an user function.
Please login to merge, or discard this patch.