| Conditions | 7 |
| Paths | 4 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 7.0957 |
| Changes | 0 | ||
| 1 | <?php |
||
| 56 | 8 | public function canVoteOn($actionName, $subject, IVotingContext $context) |
|
| 57 | { |
||
| 58 | 8 | if ($this->subjectClassName && !($subject instanceof $this->subjectClassName)) { |
|
| 59 | return false; |
||
| 60 | } |
||
| 61 | |||
| 62 | 8 | if ($this->contextClassName && !($context instanceof $this->contextClassName)) { |
|
| 63 | 2 | return false; |
|
| 64 | } |
||
| 65 | |||
| 66 | 6 | if ($this->actionList && !in_array($actionName, $this->actionList)) { |
|
|
|
|||
| 67 | 2 | return false; |
|
| 68 | } |
||
| 69 | 5 | return true; |
|
| 70 | } |
||
| 71 | |||
| 73 |
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.