| Conditions | 3 |
| Paths | 3 |
| Total Lines | 11 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function validate($data): Result |
||
| 26 | { |
||
| 27 | $result = (new StringType())->validate($data); |
||
| 28 | |||
| 29 | if (!$result->isValid()) |
||
| 30 | return new $result; |
||
| 31 | |||
| 32 | if (ctype_alpha(str_replace($this->allowedSpecialChars, '', $data))) |
||
| 33 | return new Success(); |
||
| 34 | else |
||
| 35 | return new Failure(new RuleError(RuleErrorCode::NOT_ALPHA, 'String is not Alphabetic.')); |
||
| 36 | } |
||
| 37 | } |