vendor/sensio/framework-extra-bundle/src/Configuration/Method.php line 14

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 Sensio\Bundle\FrameworkExtraBundle\Configuration;
  11. @trigger_error(sprintf('The "%s" annotation is deprecated since version 5.2. Use "%s" instead.', Method::class, \Symfony\Component\Routing\Annotation\Route::class), \E_USER_DEPRECATED);
  12. /**
  13. * The Method class handles the Method annotation parts.
  14. *
  15. * @author Fabien Potencier <[email protected]>
  16. * @Annotation
  17. *
  18. * @deprecated since version 5.2
  19. */
  20. class Method extends ConfigurationAnnotation
  21. {
  22. /**
  23. * An array of restricted HTTP methods.
  24. *
  25. * @var array
  26. */
  27. private $methods = [];
  28. /**
  29. * Returns the array of HTTP methods.
  30. *
  31. * @return array
  32. */
  33. public function getMethods()
  34. {
  35. return $this->methods;
  36. }
  37. /**
  38. * Sets the HTTP methods.
  39. *
  40. * @param array|string $methods An HTTP method or an array of HTTP methods
  41. */
  42. public function setMethods($methods)
  43. {
  44. $this->methods = \is_array($methods) ? $methods : [$methods];
  45. }
  46. /**
  47. * Sets the HTTP methods.
  48. *
  49. * @param array|string $methods An HTTP method or an array of HTTP methods
  50. */
  51. public function setValue($methods)
  52. {
  53. $this->setMethods($methods);
  54. }
  55. /**
  56. * Returns the annotation alias name.
  57. *
  58. * @return string
  59. *
  60. * @see ConfigurationInterface
  61. */
  62. public function getAliasName()
  63. {
  64. return 'method';
  65. }
  66. /**
  67. * Only one method directive is allowed.
  68. *
  69. * @return bool
  70. *
  71. * @see ConfigurationInterface
  72. */
  73. public function allowArray()
  74. {
  75. return false;
  76. }
  77. }