Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
20 | public function validate($data) : Result\Result |
||
21 | { |
||
22 | $result = (new StringType())->validate($data); |
||
23 | |||
24 | if (!$result->isValid()) |
||
25 | return new $result; |
||
26 | |||
27 | if (mb_strlen($data, 'UTF-8') >= $this->minLength) { |
||
28 | return new Result\Success(); |
||
29 | } |
||
30 | else return new Result\Failure( |
||
31 | new RuleError(RuleErrorCode::LENGTH_ERROR, |
||
32 | 'The supplied string is too short')); |
||
33 | } |
||
34 | } |