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