Total Complexity | 8 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 50% |
Changes | 0 |
1 | <?php |
||
18 | class DeleteUserVoter extends Voter |
||
19 | { |
||
20 | public const CAN_DELETE_USER = 'CAN_DELETE_USER'; |
||
21 | |||
22 | /** |
||
23 | * {@inheritdoc} |
||
24 | */ |
||
25 | 15 | protected function supports($attribute, $subject) |
|
26 | { |
||
27 | // you only want to vote if the attribute and subject are what you expect |
||
28 | 15 | return self::CAN_DELETE_USER === $attribute && ($subject instanceof User || null === $subject); |
|
29 | } |
||
30 | |||
31 | /** |
||
32 | * {@inheritdoc} |
||
33 | */ |
||
34 | 2 | protected function voteOnAttribute($attribute, $subject, TokenInterface $token) |
|
56 | } |
||
57 | } |
||
58 |