Conditions | 5 |
Paths | 4 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
39 | 2 | public function validate(FieldInterface $field, InputModel $model, InputValidation $validation) |
|
40 | { |
||
41 | 2 | $input = $model->getInput($field); |
|
42 | |||
43 | 2 | if ($input === null) { |
|
44 | 1 | $model->setError($field, $this->error ?: lang::text("mindplay/kissform", "noToken")); |
|
45 | } |
||
46 | |||
47 | 2 | if (! $this->service->checkToken($field->getName(), $input)) { |
|
|
|||
48 | 2 | $model->setError($field, $this->error ?: lang::text("mindplay/kissform", "token")); |
|
49 | } |
||
50 | 2 | } |
|
51 | } |
||
52 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.