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