| Conditions | 6 |
| Paths | 6 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 6 |
| Changes | 4 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 42 | 9 | protected function prepareFiltrator(InputFilter $input) |
|
| 43 | { |
||
| 44 | 9 | $filters = $this->getFilters(); |
|
| 45 | 9 | if (!$filters || !is_array($filters)) { |
|
|
|
|||
| 46 | 7 | return; |
|
| 47 | } |
||
| 48 | |||
| 49 | 2 | $filtrator = $input->getFiltrator(); |
|
| 50 | |||
| 51 | 2 | foreach ($filters as $filter) { |
|
| 52 | 2 | $params = is_array($filter) ? $filter : array($filter); |
|
| 53 | 2 | if (isset($params[0])) { |
|
| 54 | 2 | $filtrator->add($this->getName(), $params[0], @$params[1], @$params[2], @$params[3]); |
|
| 55 | 2 | } |
|
| 56 | 2 | } |
|
| 57 | 2 | } |
|
| 58 | |||
| 60 |
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.