| Total Complexity | 5 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | final class ResourceFileVoter extends Voter |
||
| 18 | { |
||
| 19 | public const DOWNLOAD = 'VIEW'; |
||
| 20 | |||
| 21 | public function __construct( |
||
| 22 | private readonly AccessDecisionManagerInterface $accessDecisionManager, |
||
| 23 | ) {} |
||
| 24 | |||
| 25 | protected function supports(string $attribute, mixed $subject): bool |
||
| 26 | { |
||
| 27 | $options = [ |
||
| 28 | self::DOWNLOAD, |
||
| 29 | ]; |
||
| 30 | |||
| 31 | if (!\in_array($attribute, $options, true)) { |
||
| 32 | return false; |
||
| 33 | } |
||
| 34 | |||
| 35 | return $subject instanceof ResourceFile; |
||
| 36 | } |
||
| 37 | |||
| 38 | protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool |
||
| 54 | }; |
||
| 55 | } |
||
| 56 | } |
||
| 57 |