Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
35 | 1 | public function validate(FieldInterface $field, InputModel $model, InputValidation $validation) |
|
36 | { |
||
37 | 1 | $input = $model->getInput($field); |
|
38 | |||
39 | 1 | if ($input === null) { |
|
40 | 1 | return; // no value |
|
41 | } |
||
42 | |||
43 | 1 | if (!preg_match($this->pattern, $input)) { |
|
44 | 1 | $model->setError($field, $this->error); |
|
45 | } |
||
46 | 1 | } |
|
47 | } |
||
48 |