Security update for Core, with self-updated composer
[yaffs-website] / vendor / symfony / routing / Annotation / Route.php
1 <?php
2
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 namespace Symfony\Component\Routing\Annotation;
13
14 /**
15  * Annotation class for @Route().
16  *
17  * @Annotation
18  * @Target({"CLASS", "METHOD"})
19  *
20  * @author Fabien Potencier <fabien@symfony.com>
21  */
22 class Route
23 {
24     private $path;
25     private $name;
26     private $requirements = array();
27     private $options = array();
28     private $defaults = array();
29     private $host;
30     private $methods = array();
31     private $schemes = array();
32     private $condition;
33
34     /**
35      * Constructor.
36      *
37      * @param array $data An array of key/value parameters
38      *
39      * @throws \BadMethodCallException
40      */
41     public function __construct(array $data)
42     {
43         if (isset($data['value'])) {
44             $data['path'] = $data['value'];
45             unset($data['value']);
46         }
47
48         foreach ($data as $key => $value) {
49             $method = 'set'.str_replace('_', '', $key);
50             if (!method_exists($this, $method)) {
51                 throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, get_class($this)));
52             }
53             $this->$method($value);
54         }
55     }
56
57     public function setPath($path)
58     {
59         $this->path = $path;
60     }
61
62     public function getPath()
63     {
64         return $this->path;
65     }
66
67     public function setHost($pattern)
68     {
69         $this->host = $pattern;
70     }
71
72     public function getHost()
73     {
74         return $this->host;
75     }
76
77     public function setName($name)
78     {
79         $this->name = $name;
80     }
81
82     public function getName()
83     {
84         return $this->name;
85     }
86
87     public function setRequirements($requirements)
88     {
89         $this->requirements = $requirements;
90     }
91
92     public function getRequirements()
93     {
94         return $this->requirements;
95     }
96
97     public function setOptions($options)
98     {
99         $this->options = $options;
100     }
101
102     public function getOptions()
103     {
104         return $this->options;
105     }
106
107     public function setDefaults($defaults)
108     {
109         $this->defaults = $defaults;
110     }
111
112     public function getDefaults()
113     {
114         return $this->defaults;
115     }
116
117     public function setSchemes($schemes)
118     {
119         $this->schemes = is_array($schemes) ? $schemes : array($schemes);
120     }
121
122     public function getSchemes()
123     {
124         return $this->schemes;
125     }
126
127     public function setMethods($methods)
128     {
129         $this->methods = is_array($methods) ? $methods : array($methods);
130     }
131
132     public function getMethods()
133     {
134         return $this->methods;
135     }
136
137     public function setCondition($condition)
138     {
139         $this->condition = $condition;
140     }
141
142     public function getCondition()
143     {
144         return $this->condition;
145     }
146 }