src/Security/Voter/API/Crypto/SignedPreKey/ViewVoter.php line 13
<?phpdeclare(strict_types=1);namespace App\Security\Voter\API\Crypto\SignedPreKey;use ApiPlatform\Core\Bridge\Doctrine\Orm\Paginator;use App\Data\Crypto\Key\SignedPreKey;use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;use Symfony\Component\Security\Core\Authorization\Voter\Voter;class ViewVoter extends Voter{protected function supports(string $attribute, mixed $subject): bool{return $attribute === 'VIEW_SIGNED_PRE_KEYS';}protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool{/** @var ?SignedPreKey[] $items */$items = null;if ($subject instanceof SignedPreKey) {$items = [$subject];}else if ($subject instanceof Paginator) {$items = [];foreach ($subject as $item) {$items[] = $item;}}if ($items !== null) {foreach ($items as $key) {if ($key->getUser() !== $token->getUser()) {return false;}}return true;}return false;}}