Conditions | 1 |
Paths | 1 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
20 | protected function validate($input): Text |
||
21 | { |
||
22 | $settings = $this->getSettings(); |
||
23 | $min = $settings['min'] ?? self::MIN_LEN; |
||
24 | $max = $settings['max'] ?? self::MAX_LEN; |
||
25 | |||
26 | Assertion::string($input, 'Must be a string.'); |
||
27 | $text = trim($input); |
||
28 | Assertion::betweenLength($text, $min, $max, "Must be between $min and $max characters."); |
||
29 | |||
30 | return Text::fromNative($text); |
||
31 | } |
||
33 |