1 | <?php |
||
39 | class ActionDescriptor extends AbstractNameAwareDescriptor implements ActionDescriptorInterface |
||
40 | { |
||
41 | |||
42 | /** |
||
43 | * The action method name. |
||
44 | * |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $methodName; |
||
48 | |||
49 | /** |
||
50 | * The request methods the action is listening to. |
||
51 | * |
||
52 | * @var array |
||
53 | */ |
||
54 | protected $requestMethods; |
||
55 | |||
56 | /** |
||
57 | * The restrictions for the route placeholders. |
||
58 | * |
||
59 | * @var array |
||
60 | */ |
||
61 | protected $restrictions; |
||
62 | |||
63 | /** |
||
64 | * The defaults for the route placeholders. |
||
65 | * |
||
66 | * @var array |
||
67 | */ |
||
68 | protected $defaults; |
||
69 | |||
70 | /** |
||
71 | * Initializes the descriptor with the default |
||
72 | * request methods the action is listening to. |
||
73 | */ |
||
74 | 9 | public function __construct() |
|
94 | |||
95 | /** |
||
96 | * Sets the action method name. |
||
97 | * |
||
98 | * @param string $methodName The action method name |
||
99 | * |
||
100 | * @return void |
||
101 | */ |
||
102 | 8 | public function setMethodName($methodName) |
|
106 | |||
107 | /** |
||
108 | * Returns the action method name. |
||
109 | * |
||
110 | * @return string The action method name |
||
111 | */ |
||
112 | 3 | public function getMethodName() |
|
116 | |||
117 | /** |
||
118 | * Sets the request methods the action is listening to. |
||
119 | * |
||
120 | * @param array $requestMethods The request methods |
||
121 | * |
||
122 | * @return void |
||
123 | */ |
||
124 | 3 | public function setRequestMethods(array $requestMethods) |
|
128 | |||
129 | /** |
||
130 | * Returns the request methods the action is listening to. |
||
131 | * |
||
132 | * @return array The request methods |
||
133 | */ |
||
134 | 8 | public function getRequestMethods() |
|
138 | |||
139 | /** |
||
140 | * Sets the restrictions for the route placeholders. |
||
141 | * |
||
142 | * @param array $restrictions The restrictions for the route placeholders |
||
143 | * |
||
144 | * @return void |
||
145 | */ |
||
146 | public function setRestrictions(array $restrictions) |
||
150 | |||
151 | /** |
||
152 | * Returns the restrictions for the route placeholders. |
||
153 | * |
||
154 | * @return array The restrictions for the route placeholders |
||
155 | */ |
||
156 | public function getRestrictions() |
||
160 | |||
161 | /** |
||
162 | * Sets the defaults for the route placeholders. |
||
163 | * |
||
164 | * @param array $defaults The defaults for the route placeholders |
||
165 | * |
||
166 | * @return void |
||
167 | */ |
||
168 | public function setDefaults(array $defaults) |
||
172 | |||
173 | /** |
||
174 | * Returns the defaults for the route placeholders. |
||
175 | * |
||
176 | * @return array The defaults for the route placeholders |
||
177 | */ |
||
178 | public function getDefaults() |
||
182 | |||
183 | /** |
||
184 | * Returns a new descriptor instance. |
||
185 | * |
||
186 | * @return \AppserverIo\Routlt\Description\ActionDescriptorInterface The descriptor instance |
||
187 | */ |
||
188 | 4 | public static function newDescriptorInstance() |
|
192 | |||
193 | /** |
||
194 | * Returns a new annotation instance for the passed reflection method. |
||
195 | * |
||
196 | * @param \AppserverIo\Lang\Reflection\MethodInterface $reflectionMethod The reflection method with the action configuration |
||
197 | * |
||
198 | * @return \AppserverIo\Lang\Reflection\AnnotationInterface The reflection annotation |
||
199 | */ |
||
200 | 7 | protected function newAnnotationInstance(MethodInterface $reflectionMethod) |
|
204 | |||
205 | /** |
||
206 | * Initializes the action configuration instance from the passed reflection method instance. |
||
207 | * |
||
208 | * @param \AppserverIo\Lang\Reflection\MethodInterface $reflectionMethod The reflection method with the action configuration |
||
209 | * |
||
210 | * @return \AppserverIo\Routlt\Description\ActionDescriptorInterface The initialized descriptor |
||
211 | */ |
||
212 | 8 | public function fromReflectionMethod(MethodInterface $reflectionMethod) |
|
291 | |||
292 | /** |
||
293 | * Initializes a action configuration instance from the passed deployment descriptor node. |
||
294 | * |
||
295 | * @param \SimpleXmlElement $node The deployment node with the action configuration |
||
296 | * |
||
297 | * @return \AppserverIo\Routlt\Description\ActionDescriptorInterface The initialized descriptor |
||
298 | */ |
||
299 | 1 | public function fromDeploymentDescriptor(\SimpleXmlElement $node) |
|
302 | |||
303 | /** |
||
304 | * Initializes a action configuration instance from the passed configuration node. |
||
305 | * |
||
306 | * @param \AppserverIo\Configuration\Interfaces\NodeInterface $node The configuration node with the action configuration |
||
307 | * |
||
308 | * @return \AppserverIo\Routlt\Description\ActionDescriptorInterface The initialized descriptor |
||
309 | */ |
||
310 | public function fromConfiguration(NodeInterface $node) |
||
313 | |||
314 | /** |
||
315 | * Merges the passed configuration into this one. Configuration values |
||
316 | * of the passed configuration will overwrite the this one. |
||
317 | * |
||
318 | * @param \AppserverIo\Routlt\Description\ActionDescriptorInterface $actionDescriptor The configuration to merge |
||
319 | * |
||
320 | * @return void |
||
321 | * @throws \AppserverIo\Routlt\Description\DescriptorException Is thrown if the passed descriptor has a different method name |
||
322 | */ |
||
323 | 2 | public function merge(ActionDescriptorInterface $actionDescriptor) |
|
338 | } |
||
339 |