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 | ||
| 18 | final class AgentStatVoter extends Voter | |
| 19 | { | |
| 20 | public const string VIEW = 'AGENT_STAT_VIEW'; | |
| 21 | ||
| 22 | #[\Override] | |
| 23 | protected function supports(string $attribute, mixed $subject): bool | |
| 24 | { | |
| 25 | return self::VIEW === $attribute && $subject instanceof AgentStat; | |
| 26 | } | |
| 27 | ||
| 28 | #[\Override] | |
| 29 | protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token, ?Vote $vote = null): bool | |
| 30 | { | |
| 31 | $user = $token->getUser(); | |
| 32 | ||
| 33 | return $user instanceof User | |
| 34 | && $subject->owner->id === $user->id; | |
| 35 | } | |
| 36 | } |