vendor/sensio/framework-extra-bundle/src/Configuration/IsGranted.php line 20

Open in your IDE?
  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 Sensio\Bundle\FrameworkExtraBundle\Configuration;
  11. /**
  12. * The Security class handles the Security annotation.
  13. *
  14. * @author Ryan Weaver <ryan@knpuniversity.com>
  15. * @Annotation
  16. */
  17. class IsGranted extends ConfigurationAnnotation
  18. {
  19. /**
  20. * Sets the first argument that will be passed to isGranted().
  21. *
  22. * @var mixed
  23. */
  24. private $attributes;
  25. /**
  26. * Sets the second argument passed to isGranted().
  27. *
  28. * @var mixed
  29. */
  30. private $subject;
  31. /**
  32. * The message of the exception - has a nice default if not set.
  33. *
  34. * @var string
  35. */
  36. private $message;
  37. /**
  38. * If set, will throw Symfony\Component\HttpKernel\Exception\HttpException
  39. * with the given $statusCode.
  40. * If null, Symfony\Component\Security\Core\Exception\AccessDeniedException.
  41. * will be used.
  42. *
  43. * @var int|null
  44. */
  45. private $statusCode;
  46. public function setAttributes($attributes)
  47. {
  48. $this->attributes = $attributes;
  49. }
  50. public function getAttributes()
  51. {
  52. return $this->attributes;
  53. }
  54. public function setSubject($subject)
  55. {
  56. $this->subject = $subject;
  57. }
  58. public function getSubject()
  59. {
  60. return $this->subject;
  61. }
  62. public function getMessage()
  63. {
  64. return $this->message;
  65. }
  66. public function setMessage($message)
  67. {
  68. $this->message = $message;
  69. }
  70. public function getStatusCode()
  71. {
  72. return $this->statusCode;
  73. }
  74. public function setStatusCode($statusCode)
  75. {
  76. $this->statusCode = $statusCode;
  77. }
  78. public function setValue($value)
  79. {
  80. $this->setAttributes($value);
  81. }
  82. public function getAliasName()
  83. {
  84. return 'is_granted';
  85. }
  86. public function allowArray()
  87. {
  88. return true;
  89. }
  90. }