<?php
declare(strict_types=1);
namespace App\Security\Voter;
use App\Entity\Cart;
use App\Entity\Password\Request;
use App\Entity\Show\Session;
use App\Entity\User;
use App\Manager\CartManager;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
use Symfony\Component\Security\Core\Security;
class RequestVoter extends Voter
{
protected function supports(string $attribute, $subject): bool
{
return $attribute === 'REQUEST_NOT_EXPIRED' && $subject instanceof Request;
}
/**
* @param string $attribute
* @param Request $subject
* @param TokenInterface $token
* @return bool
*/
protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token): bool
{
return $subject->getExpiredAt() > new \DateTimeImmutable();
}
}