| Conditions | 3 |
| Paths | 3 |
| Total Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 3.0416 |
| Changes | 0 | ||
| 1 | <?php |
||
| 46 | 10 | public function vote($votingSubject, IVotingContext $votingContext) |
|
| 47 | { |
||
| 48 | 10 | if (!($votingContext instanceof IIdentityContext)) { |
|
| 49 | throw new InvalidArgumentException('RoleVoter can be used only with specific voting context, implementing IIdentityContext.'); |
||
| 50 | } |
||
| 51 | |||
| 52 | 10 | if (array_intersect($votingContext->getRoles(), $this->allowedRoles)) { |
|
| 53 | 6 | return new SingleVoterResult($this->resultDecision, $this->reason); |
|
| 54 | } |
||
| 55 | 5 | return null; |
|
| 56 | } |
||
| 57 | } |
||
| 58 |