@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | //if the rule is array |
| 184 | 184 | if (is_array($rule)) { |
| 185 | 185 | $rules = $rule; |
| 186 | - } else{ |
|
| 186 | + } else { |
|
| 187 | 187 | //the rule is not an array explode pipe values |
| 188 | 188 | $rules = explode('|', $rule); |
| 189 | 189 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | $this->checkCsrf(); |
| 286 | 286 | |
| 287 | 287 | //Now loop in each field rule and validate it |
| 288 | - foreach($this->rules as $field => $rules) { |
|
| 288 | + foreach ($this->rules as $field => $rules) { |
|
| 289 | 289 | $this->validateField($field, $rules); |
| 290 | 290 | } |
| 291 | 291 | $this->valid = empty($this->errors) && $this->forceError === false; |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | if ($field !== null) { |
| 321 | 321 | $this->customErrors[$field][$rule] = $message; |
| 322 | 322 | } else { |
| 323 | - foreach(array_keys($this->rules) as $field) { |
|
| 323 | + foreach (array_keys($this->rules) as $field) { |
|
| 324 | 324 | $this->customErrors[$field][$rule] = $message; |
| 325 | 325 | } |
| 326 | 326 | } |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | * |
| 352 | 352 | * @return object the current instance |
| 353 | 353 | */ |
| 354 | - protected function setDatabaseFromSuperInstanceIfNotSet(){ |
|
| 354 | + protected function setDatabaseFromSuperInstanceIfNotSet() { |
|
| 355 | 355 | if (!is_object($this->database)) { |
| 356 | 356 | $this->database = get_instance()->database; |
| 357 | 357 | } |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | * @return object the current instance |
| 425 | 425 | */ |
| 426 | 426 | protected function filterValidationData() { |
| 427 | - foreach($this->data as $key => $value ) { |
|
| 427 | + foreach ($this->data as $key => $value) { |
|
| 428 | 428 | $this->data[$key] = trim($value); |
| 429 | 429 | } |
| 430 | 430 | return $this; |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | * @param array $rules the list of rule to validate |
| 485 | 485 | */ |
| 486 | 486 | protected function validateField($field, array $rules) { |
| 487 | - foreach($rules as $rule) { |
|
| 487 | + foreach ($rules as $rule) { |
|
| 488 | 488 | $match = array(); |
| 489 | 489 | $paramValue = null; |
| 490 | 490 | //Is the rule with parameter ?? |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | if (method_exists($this, $method)) { |
| 503 | 503 | call_user_func_array(array($this, $method), array($field, $realRuleName, $paramValue)); |
| 504 | 504 | } |
| 505 | - else{ |
|
| 505 | + else { |
|
| 506 | 506 | $this->forceError = true; |
| 507 | 507 | show_error('Invalid validaton rule "' . $realRuleName . '"'); |
| 508 | 508 | } |
@@ -1034,7 +1034,7 @@ discard block |
||
| 1034 | 1034 | if (call_user_func_array($paramValue, array($value)) === false) { |
| 1035 | 1035 | $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
| 1036 | 1036 | } |
| 1037 | - } else{ |
|
| 1037 | + } else { |
|
| 1038 | 1038 | $this->forceError = true; |
| 1039 | 1039 | show_error('The callback validation function/method "' . $paramValue . '" does not exist'); |
| 1040 | 1040 | } |