| Conditions | 6 |
| Paths | 6 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 41 | 9 | protected function prepareValidator(InputFilter $input) |
|
| 42 | { |
||
| 43 | 9 | $validationRules = $this->getValidationRules(); |
|
| 44 | 9 | if (!$validationRules || !is_array($validationRules)) { |
|
|
|
|||
| 45 | 7 | return; |
|
| 46 | } |
||
| 47 | 5 | $validator = $input->getValidator(); |
|
| 48 | 5 | foreach ($validationRules as $rule) { |
|
| 49 | 5 | $params = is_array($rule) ? $rule : array( |
|
| 50 | 5 | $rule |
|
| 51 | ); |
||
| 52 | 5 | if (isset($params[0])) { |
|
| 53 | 5 | $validator->add($this->getName(), $params[0], @$params[1], @$params[2], $this->getLabel()); |
|
| 54 | } |
||
| 55 | } |
||
| 56 | 5 | } |
|
| 57 | } |
||
| 58 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.