Conditions | 5 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
43 | 1 | public function validate(FieldInterface $field, InputModel $model, InputValidation $validation) |
|
44 | { |
||
45 | 1 | $input = $model->getInput($field); |
|
46 | |||
47 | 1 | if ($input === null) { |
|
48 | 1 | return; // no input given |
|
49 | } |
||
50 | |||
51 | 1 | $length = mb_strlen($input); |
|
52 | |||
53 | 1 | if ($length < $this->min || $length > $this->max) { |
|
54 | 1 | $model->setError( |
|
55 | 1 | $field, |
|
56 | 1 | $this->error ?: lang::text("mindplay/kissform", "length", ["field" => $validation->getLabel($field), "min" => $this->min, "max" => $this->max]) |
|
57 | ); |
||
58 | } |
||
59 | 1 | } |
|
60 | } |
||
61 |