Method.php 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace Sensio\Bundle\FrameworkExtraBundle\Configuration;
  3. /*
  4. * This file is part of the Symfony package.
  5. *
  6. * (c) Fabien Potencier <fabien@symfony.com>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. /**
  12. * The Method class handles the @Method annotation parts.
  13. *
  14. * @author Fabien Potencier <fabien@symfony.com>
  15. * @Annotation
  16. */
  17. class Method extends ConfigurationAnnotation
  18. {
  19. /**
  20. * An array of restricted HTTP methods.
  21. *
  22. * @var array
  23. */
  24. protected $methods = array();
  25. /**
  26. * Returns the array of HTTP methods.
  27. *
  28. * @return array
  29. */
  30. public function getMethods()
  31. {
  32. return $this->methods;
  33. }
  34. /**
  35. * Sets the HTTP methods.
  36. *
  37. * @param array|string $methods An HTTP method or an array of HTTP methods
  38. */
  39. public function setMethods($methods)
  40. {
  41. $this->methods = is_array($methods) ? $methods : array($methods);
  42. }
  43. /**
  44. * Sets the HTTP methods.
  45. *
  46. * @param array|string $methods An HTTP method or an array of HTTP methods
  47. */
  48. public function setValue($methods)
  49. {
  50. $this->setMethods($methods);
  51. }
  52. /**
  53. * Returns the annotation alias name.
  54. *
  55. * @return string
  56. * @see ConfigurationInterface
  57. */
  58. public function getAliasName()
  59. {
  60. return 'method';
  61. }
  62. }