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