| Conditions | 4 |
| Paths | 4 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 4.25 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | 5 | protected function voteOnAttribute($attribute, $subject, TokenInterface $token) { |
|
| 25 | 5 | $user = $token->getUser(); |
|
| 26 | |||
| 27 | 5 | if(!$user instanceof User) { |
|
| 28 | return false; |
||
| 29 | } |
||
| 30 | |||
| 31 | switch($attribute) { |
||
| 32 | 5 | case static::CHANGE_PASSWORD: |
|
| 33 | 5 | case static::USE_2FA: |
|
| 34 | 5 | return $user->canChangePassword(); |
|
| 35 | } |
||
| 36 | |||
| 37 | throw new \LogicException('This code should not be reached'); |
||
| 38 | } |
||
| 39 | } |