vendor/sensio/framework-extra-bundle/src/Configuration/Security.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 Fabien Potencier <fabien@symfony.com>
  15. * @Annotation
  16. */
  17. class Security extends ConfigurationAnnotation
  18. {
  19. /**
  20. * The expression evaluated to allow or deny access.
  21. *
  22. * @var string
  23. */
  24. private $expression;
  25. /**
  26. * If set, will throw Symfony\Component\HttpKernel\Exception\HttpException
  27. * with the given $statusCode.
  28. * If null, Symfony\Component\Security\Core\Exception\AccessDeniedException.
  29. * will be used.
  30. *
  31. * @var int|null
  32. */
  33. protected $statusCode;
  34. /**
  35. * The message of the exception.
  36. *
  37. * @var string
  38. */
  39. protected $message = 'Access denied.';
  40. public function getExpression()
  41. {
  42. return $this->expression;
  43. }
  44. public function setExpression($expression)
  45. {
  46. $this->expression = $expression;
  47. }
  48. public function getStatusCode()
  49. {
  50. return $this->statusCode;
  51. }
  52. public function setStatusCode($statusCode)
  53. {
  54. $this->statusCode = $statusCode;
  55. }
  56. public function getMessage()
  57. {
  58. return $this->message;
  59. }
  60. public function setMessage($message)
  61. {
  62. $this->message = $message;
  63. }
  64. public function setValue($expression)
  65. {
  66. $this->setExpression($expression);
  67. }
  68. public function getAliasName()
  69. {
  70. return 'security';
  71. }
  72. public function allowArray()
  73. {
  74. return true;
  75. }
  76. }