VoteEvent.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Security\Core\Event;
  11. use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
  12. use Symfony\Contracts\EventDispatcher\Event;
  13. /**
  14. * This event is dispatched on voter vote.
  15. *
  16. * @author Laurent VOULLEMIER <laurent.voullemier@gmail.com>
  17. *
  18. * @internal
  19. */
  20. final class VoteEvent extends Event
  21. {
  22. private $voter;
  23. private $subject;
  24. private $attributes;
  25. private $vote;
  26. public function __construct(VoterInterface $voter, $subject, array $attributes, int $vote)
  27. {
  28. $this->voter = $voter;
  29. $this->subject = $subject;
  30. $this->attributes = $attributes;
  31. $this->vote = $vote;
  32. }
  33. public function getVoter(): VoterInterface
  34. {
  35. return $this->voter;
  36. }
  37. public function getSubject()
  38. {
  39. return $this->subject;
  40. }
  41. public function getAttributes(): array
  42. {
  43. return $this->attributes;
  44. }
  45. public function getVote(): int
  46. {
  47. return $this->vote;
  48. }
  49. }