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