Total Complexity | 6 |
Total Lines | 26 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
18 | class DeleteBookVoter extends Voter |
||
19 | { |
||
20 | public const CAN_DELETE_BOOK = 'CAN_DELETE_BOOK'; |
||
21 | |||
22 | /** |
||
23 | * {@inheritdoc} |
||
24 | */ |
||
25 | 31 | protected function supports($attribute, $subject) |
|
26 | { |
||
27 | // you only want to vote if the attribute and subject are what you expect |
||
28 | 31 | return self::CAN_DELETE_BOOK === $attribute && ($subject instanceof Book || null === $subject); |
|
29 | } |
||
30 | |||
31 | /** |
||
32 | * {@inheritdoc} |
||
33 | */ |
||
34 | 3 | protected function voteOnAttribute($attribute, $subject, TokenInterface $token) |
|
44 | } |
||
45 | } |
||
46 |