Conditions | 6 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
38 | 1 | public function validate(FieldInterface $field, InputModel $model, InputValidation $validation) |
|
39 | { |
||
40 | 1 | parent::validate($field, $model, $validation); |
|
41 | |||
42 | 1 | if ($model->hasError($field)) { |
|
43 | return; // parent validation (IsNumber) failed |
||
44 | } |
||
45 | |||
46 | 1 | $input = $model->getInput($field); |
|
47 | |||
48 | 1 | if ($input === null) { |
|
49 | 1 | return; // no input, no minimum value |
|
50 | } |
||
51 | |||
52 | 1 | if ($input < $this->min || $input > $this->max) { |
|
53 | 1 | $model->setError( |
|
54 | $field, |
||
55 | 1 | $this->error ?: lang::text("mindplay/kissform", "range", ["field" => $validation->getLabel($field), "min" => $this->min, "max" => $this->max]) |
|
56 | ); |
||
57 | } |
||
58 | 1 | } |
|
59 | } |
||
60 |