@@ -39,9 +39,10 @@ |
||
| 39 | 39 | |
| 40 | 40 | public function validate($data): Result |
| 41 | 41 | { |
| 42 | - if (ctype_alnum(str_replace($this->allowedSpecialChars, '', $data))) |
|
| 43 | - return new Success(); |
|
| 44 | - else |
|
| 45 | - return new Failure(new RuleError(RuleErrorCode::NOT_ALNUM, 'String is not Alphanumeric.')); |
|
| 42 | + if (ctype_alnum(str_replace($this->allowedSpecialChars, '', $data))) { |
|
| 43 | + return new Success(); |
|
| 44 | + } else { |
|
| 45 | + return new Failure(new RuleError(RuleErrorCode::NOT_ALNUM, 'String is not Alphanumeric.')); |
|
| 46 | + } |
|
| 46 | 47 | } |
| 47 | 48 | } |
| 48 | 49 | \ No newline at end of file |
@@ -27,8 +27,9 @@ |
||
| 27 | 27 | { |
| 28 | 28 | $numericResult = (new Numeric())->validate($value); |
| 29 | 29 | |
| 30 | - if (!$numericResult->isValid()) |
|
| 31 | - return new $numericResult; |
|
| 30 | + if (!$numericResult->isValid()) { |
|
| 31 | + return new $numericResult; |
|
| 32 | + } |
|
| 32 | 33 | |
| 33 | 34 | if (filter_var(str_replace($this->allowedSpecialChars, '', $value), FILTER_VALIDATE_INT) !== false) { |
| 34 | 35 | return new Success(); |