Conditions | 4 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | public function validate($value): ?string |
||
19 | { |
||
20 | if (!is_string($value)) { |
||
21 | return "This value must be a string."; |
||
22 | } |
||
23 | |||
24 | $length = strlen($value); |
||
25 | if ($length < $this->min || $length > $this->max) { |
||
26 | return "This value must be between {$this->min} and {$this->max} characters long."; |
||
27 | } |
||
28 | |||
29 | return null; |
||
30 | } |
||
31 | } |