src/Contact/Security/ContactNew/Voter.php line 25
<?phpdeclare(strict_types=1);/*** Copyright (c) 2023 TECLA Consulting Group oü.* All rights reserved.** This unpublished material is proprietary to TECLA Consulting Group oü.* All rights reserved. The methods and* techniques described herein are considered trade secrets* and/or confidential. Reproduction or distribution, in whole* or in part, is forbidden except by express written permission* of TECLA Consulting Group oü.** @author Matúš Sýkorjak <matus@tecla.no>* @copyright 2023 TECLA Consulting Group oü*/namespace App\Contact\Security\ContactNew;use Symfony\Component\DependencyInjection\ServiceLocator;use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;use Symfony\Component\Security\Core\Authorization\Voter\Voter as BaseVoter;final class Voter extends BaseVoter{private ServiceLocator $permissions;public function __construct(ServiceLocator $permissions){$this->permissions = $permissions;}public function supportsAttribute(string $attribute): bool{return $this->permissions->has($attribute);}protected function supports(string $attribute, $subject): bool{return $this->supportsAttribute($attribute);}protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool{/** @var PermissionInterface $permission */$permission = ($this->permissions)($attribute);if (null !== $permission) {return $permission->isGranted($subject);}throw new \LogicException('This code should not be reached!');}}