vendor/symfony/security-core/Exception/AccessDeniedException.php line 19

Open in your IDE?
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <[email protected]>
  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\Exception;
  11. /**
  12. * AccessDeniedException is thrown when the account has not the required role.
  13. *
  14. * @author Fabien Potencier <[email protected]>
  15. */
  16. class AccessDeniedException extends RuntimeException
  17. {
  18. private $attributes = [];
  19. private $subject;
  20. public function __construct(string $message = 'Access Denied.', ?\Throwable $previous = null)
  21. {
  22. parent::__construct($message, 403, $previous);
  23. }
  24. /**
  25. * @return array
  26. */
  27. public function getAttributes()
  28. {
  29. return $this->attributes;
  30. }
  31. /**
  32. * @param array|string $attributes
  33. */
  34. public function setAttributes($attributes)
  35. {
  36. $this->attributes = (array) $attributes;
  37. }
  38. /**
  39. * @return mixed
  40. */
  41. public function getSubject()
  42. {
  43. return $this->subject;
  44. }
  45. /**
  46. * @param mixed $subject
  47. */
  48. public function setSubject($subject)
  49. {
  50. $this->subject = $subject;
  51. }
  52. }