Lines
100.00%
4 / 4
Methods
100.00%
2 / 2
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| supports | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 2 | ||
| voteOnAttribute | 100.00% | 3 / 3 | 100.00% | 1 / 1 | 2 | ||
| 19 | final class DoneBannerVoter extends Voter | |
| 20 | { | |
| 21 | public const string EDIT = 'DONE_BANNER_EDIT'; | |
| 22 | ||
| 23 | #[\Override] | |
| 24 | protected function supports(string $attribute, mixed $subject): bool | |
| 25 | { | |
| 26 | return self::EDIT === $attribute && $subject instanceof DoneBanner; | |
| 27 | } | |
| 28 | ||
| 29 | #[\Override] | |
| 30 | protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token, ?Vote $vote = null): bool | |
| 31 | { | |
| 32 | $user = $token->getUser(); | |
| 33 | ||
| 34 | return $user instanceof User | |
| 35 | && $subject->owner?->id === $user->id; | |
| 36 | } | |
| 37 | } |