vendor/sensio/framework-extra-bundle/Configuration/Method.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 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.      *
  57.      * @see ConfigurationInterface
  58.      */
  59.     public function getAliasName()
  60.     {
  61.         return 'method';
  62.     }
  63.     /**
  64.      * Only one method directive is allowed.
  65.      *
  66.      * @return bool
  67.      *
  68.      * @see ConfigurationInterface
  69.      */
  70.     public function allowArray()
  71.     {
  72.         return false;
  73.     }
  74. }