5 * @author Roland Haeder <webmaster@ship-simu.org>
7 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team
8 * @license GNU GPL 3.0 or any newer version
9 * @link http://www.ship-simu.org
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 class ???Resolver extends BaseResolver implements Resolver {
26 * Protected constructor
30 protected function __construct () {
31 // Call parent constructor
32 parent::__construct(__CLASS__);
34 // Set prefix to '???'
35 $this->setClassPrefix('???');
39 * Creates an instance of a Web action resolver with a given default action
41 * @param $!!!Name The default action we shall execute
42 * @param $appInstance An instance of a manageable application helper class
43 * @return $resolverInstance The prepared action resolver instance
44 * @throws EmptyVariableException Thrown if default action is not set
45 * @throws Invalid|||Exception Thrown if default action is invalid
47 public static final function create???Resolver ($!!!Name, ManageableApplication $appInstance) {
48 // Create the new instance
49 $resolverInstance = new ???Resolver();
51 // Is the variable $!!!Name set and the action is valid?
52 if (empty($!!!Name)) {
53 // Then thrown an exception here
54 throw new EmptyVariableException(array($resolverInstance, 'default|||'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
55 } elseif ($resolverInstance->is|||Valid($!!!Name) === false) {
56 // Invalid action found
57 throw new Invalid|||Exception(array($resolverInstance, $!!!Name), self::EXCEPTION_INVALID_ACTION);
60 // Set the application instance
61 $resolverInstance->setApplicationInstance($appInstance);
63 // Return the prepared instance
64 return $resolverInstance;
68 * Returns an action instance for a given request class or null if
71 * @param $requestInstance An instance of a request class
72 * @return $!!!Instance An instance of the resolved action
73 * @throws Invalid|||Exception Thrown if $!!!Name is
75 * @throws Invalid|||InstanceException Thrown if $!!!Instance
76 * is an invalid instance
78 public function resolve|||ByRequest (Requestable $requestInstance) {
83 // This goes fine so let's resolve the action
84 $!!!Name = $requestInstance->getRequestElement('action');
86 // Is the action empty? Then fall back to default action
87 if (empty($!!!Name)) $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action');
89 // Check if action is valid
90 if ($this->is|||Valid($!!!Name) === false) {
91 // This action is invalid!
92 throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
96 $!!!Instance = $this->load|||();
99 if ((!is_object($!!!Instance)) || (!$!!!Instance instanceof |||able)) {
100 // This action has an invalid instance!
101 throw new Invalid|||InstanceException(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
105 $this->setResolvedInstance($!!!Instance);
107 // Return the resolved action instance
112 * Resolves the action by its direct name and returns an instance of its class
114 * @return $!!!Instance An instance of the action class
115 * @throws Invalid|||Exception Thrown if $!!!Name is invalid
117 public function resolve||| () {
118 // Initiate the instance variable
122 $!!!Name = $this->get|||Name();
124 // Is the action empty? Then fall back to default action
125 if (empty($!!!Name)) {
126 $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action');
129 // Check if action is valid
130 if ($this->is|||Valid($!!!Name) === false) {
131 // This action is invalid!
132 throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
136 $!!!Instance = $this->load|||();
138 // Return the instance
149 * @author Roland Haeder <webmaster@ship-simu.org>
151 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team
152 * @license GNU GPL 3.0 or any newer version
153 * @link http://www.ship-simu.org
155 * This program is free software: you can redistribute it and/or modify
156 * it under the terms of the GNU General Public License as published by
157 * the Free Software Foundation, either version 3 of the License, or
158 * (at your option) any later version.
160 * This program is distributed in the hope that it will be useful,
161 * but WITHOUT ANY WARRANTY; without even the implied warranty of
162 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
163 * GNU General Public License for more details.
165 * You should have received a copy of the GNU General Public License
166 * along with this program. If not, see <http://www.gnu.org/licenses/>.
168 class ???Resolver extends BaseResolver implements Resolver {
170 * Protected constructor
174 protected function __construct () {
175 // Call parent constructor
176 parent::__construct(__CLASS__);
178 // Set prefix to '???'
179 $this->setClassPrefix('???');
183 * Creates an instance of a Web action resolver with a given default action
185 * @param $!!!Name The default action we shall execute
186 * @param $appInstance An instance of a manageable application helper class
187 * @return $resolverInstance The prepared action resolver instance
188 * @throws EmptyVariableException Thrown if default action is not set
189 * @throws Invalid|||Exception Thrown if default action is invalid
191 public static final function create???Resolver ($!!!Name, ManageableApplication $appInstance) {
192 // Create the new instance
193 $resolverInstance = new ???Resolver();
195 // Is the variable $!!!Name set and the action is valid?
196 if (empty($!!!Name)) {
197 // Then thrown an exception here
198 throw new EmptyVariableException(array($resolverInstance, 'default|||'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
199 } elseif ($resolverInstance->is|||Valid($!!!Name) === false) {
200 // Invalid action found
201 throw new Invalid|||Exception(array($resolverInstance, $!!!Name), self::EXCEPTION_INVALID_ACTION);
204 // Set the application instance
205 $resolverInstance->setApplicationInstance($appInstance);
207 // Return the prepared instance
208 return $resolverInstance;
212 * Returns an action instance for a given request class or null if
215 * @param $requestInstance An instance of a request class
216 * @return $!!!Instance An instance of the resolved action
217 * @throws Invalid|||Exception Thrown if $!!!Name is
219 * @throws Invalid|||InstanceException Thrown if $!!!Instance
220 * is an invalid instance
222 public function resolve|||ByRequest (Requestable $requestInstance) {
227 // This goes fine so let's resolve the action
228 $!!!Name = $requestInstance->getRequestElement('action');
230 // Is the action empty? Then fall back to default action
231 if (empty($!!!Name)) $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action');
233 // Check if action is valid
234 if ($this->is|||Valid($!!!Name) === false) {
235 // This action is invalid!
236 throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
240 $!!!Instance = $this->load|||();
243 if ((!is_object($!!!Instance)) || (!$!!!Instance instanceof |||able)) {
244 // This action has an invalid instance!
245 throw new Invalid|||InstanceException(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
249 $this->setResolvedInstance($!!!Instance);
251 // Return the resolved action instance
256 * Resolves the action by its direct name and returns an instance of its class
258 * @return $!!!Instance An instance of the action class
259 * @throws Invalid|||Exception Thrown if $!!!Name is invalid
261 public function resolve||| () {
262 // Initiate the instance variable
266 $!!!Name = $this->get|||Name();
268 // Is the action empty? Then fall back to default action
269 if (empty($!!!Name)) {
270 $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action');
273 // Check if action is valid
274 if ($this->is|||Valid($!!!Name) === false) {
275 // This action is invalid!
276 throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
280 $!!!Instance = $this->load|||();
282 // Return the instance
293 * @author Roland Haeder <webmaster@ship-simu.org>
295 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team
296 * @license GNU GPL 3.0 or any newer version
297 * @link http://www.ship-simu.org
299 * This program is free software: you can redistribute it and/or modify
300 * it under the terms of the GNU General Public License as published by
301 * the Free Software Foundation, either version 3 of the License, or
302 * (at your option) any later version.
304 * This program is distributed in the hope that it will be useful,
305 * but WITHOUT ANY WARRANTY; without even the implied warranty of
306 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
307 * GNU General Public License for more details.
309 * You should have received a copy of the GNU General Public License
310 * along with this program. If not, see <http://www.gnu.org/licenses/>.
312 class ???Resolver extends BaseResolver implements Resolver {
314 * Protected constructor
318 protected function __construct () {
319 // Call parent constructor
320 parent::__construct(__CLASS__);
322 // Set prefix to '???'
323 $this->setClassPrefix('???');
327 * Creates an instance of a Web action resolver with a given default action
329 * @param $!!!Name The default action we shall execute
330 * @param $appInstance An instance of a manageable application helper class
331 * @return $resolverInstance The prepared action resolver instance
332 * @throws EmptyVariableException Thrown if default action is not set
333 * @throws Invalid|||Exception Thrown if default action is invalid
335 public static final function create???Resolver ($!!!Name, ManageableApplication $appInstance) {
336 // Create the new instance
337 $resolverInstance = new ???Resolver();
339 // Is the variable $!!!Name set and the action is valid?
340 if (empty($!!!Name)) {
341 // Then thrown an exception here
342 throw new EmptyVariableException(array($resolverInstance, 'default|||'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
343 } elseif ($resolverInstance->is|||Valid($!!!Name) === false) {
344 // Invalid action found
345 throw new Invalid|||Exception(array($resolverInstance, $!!!Name), self::EXCEPTION_INVALID_ACTION);
348 // Set the application instance
349 $resolverInstance->setApplicationInstance($appInstance);
351 // Return the prepared instance
352 return $resolverInstance;
356 * Returns an action instance for a given request class or null if
359 * @param $requestInstance An instance of a request class
360 * @return $!!!Instance An instance of the resolved action
361 * @throws Invalid|||Exception Thrown if $!!!Name is
363 * @throws Invalid|||InstanceException Thrown if $!!!Instance
364 * is an invalid instance
366 public function resolve|||ByRequest (Requestable $requestInstance) {
371 // This goes fine so let's resolve the action
372 $!!!Name = $requestInstance->getRequestElement('action');
374 // Is the action empty? Then fall back to default action
375 if (empty($!!!Name)) $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action');
377 // Check if action is valid
378 if ($this->is|||Valid($!!!Name) === false) {
379 // This action is invalid!
380 throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
384 $!!!Instance = $this->load|||();
387 if ((!is_object($!!!Instance)) || (!$!!!Instance instanceof |||able)) {
388 // This action has an invalid instance!
389 throw new Invalid|||InstanceException(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
393 $this->setResolvedInstance($!!!Instance);
395 // Return the resolved action instance
400 * Resolves the action by its direct name and returns an instance of its class
402 * @return $!!!Instance An instance of the action class
403 * @throws Invalid|||Exception Thrown if $!!!Name is invalid
405 public function resolve||| () {
406 // Initiate the instance variable
410 $!!!Name = $this->get|||Name();
412 // Is the action empty? Then fall back to default action
413 if (empty($!!!Name)) {
414 $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action');
417 // Check if action is valid
418 if ($this->is|||Valid($!!!Name) === false) {
419 // This action is invalid!
420 throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
424 $!!!Instance = $this->load|||();
426 // Return the instance
437 * @author Roland Haeder <webmaster@ship-simu.org>
439 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team
440 * @license GNU GPL 3.0 or any newer version
441 * @link http://www.ship-simu.org
443 * This program is free software: you can redistribute it and/or modify
444 * it under the terms of the GNU General Public License as published by
445 * the Free Software Foundation, either version 3 of the License, or
446 * (at your option) any later version.
448 * This program is distributed in the hope that it will be useful,
449 * but WITHOUT ANY WARRANTY; without even the implied warranty of
450 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
451 * GNU General Public License for more details.
453 * You should have received a copy of the GNU General Public License
454 * along with this program. If not, see <http://www.gnu.org/licenses/>.
456 class ???Resolver extends BaseResolver implements Resolver {
458 * Protected constructor
462 protected function __construct () {
463 // Call parent constructor
464 parent::__construct(__CLASS__);
466 // Set prefix to '???'
467 $this->setClassPrefix('???');
471 * Creates an instance of a Web action resolver with a given default action
473 * @param $!!!Name The default action we shall execute
474 * @param $appInstance An instance of a manageable application helper class
475 * @return $resolverInstance The prepared action resolver instance
476 * @throws EmptyVariableException Thrown if default action is not set
477 * @throws Invalid|||Exception Thrown if default action is invalid
479 public static final function create???Resolver ($!!!Name, ManageableApplication $appInstance) {
480 // Create the new instance
481 $resolverInstance = new ???Resolver();
483 // Is the variable $!!!Name set and the action is valid?
484 if (empty($!!!Name)) {
485 // Then thrown an exception here
486 throw new EmptyVariableException(array($resolverInstance, 'default|||'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
487 } elseif ($resolverInstance->is|||Valid($!!!Name) === false) {
488 // Invalid action found
489 throw new Invalid|||Exception(array($resolverInstance, $!!!Name), self::EXCEPTION_INVALID_ACTION);
492 // Set the application instance
493 $resolverInstance->setApplicationInstance($appInstance);
495 // Return the prepared instance
496 return $resolverInstance;
500 * Returns an action instance for a given request class or null if
503 * @param $requestInstance An instance of a request class
504 * @return $!!!Instance An instance of the resolved action
505 * @throws Invalid|||Exception Thrown if $!!!Name is
507 * @throws Invalid|||InstanceException Thrown if $!!!Instance
508 * is an invalid instance
510 public function resolve|||ByRequest (Requestable $requestInstance) {
515 // This goes fine so let's resolve the action
516 $!!!Name = $requestInstance->getRequestElement('action');
518 // Is the action empty? Then fall back to default action
519 if (empty($!!!Name)) $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action');
521 // Check if action is valid
522 if ($this->is|||Valid($!!!Name) === false) {
523 // This action is invalid!
524 throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
528 $!!!Instance = $this->load|||();
531 if ((!is_object($!!!Instance)) || (!$!!!Instance instanceof |||able)) {
532 // This action has an invalid instance!
533 throw new Invalid|||InstanceException(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
537 $this->setResolvedInstance($!!!Instance);
539 // Return the resolved action instance
544 * Resolves the action by its direct name and returns an instance of its class
546 * @return $!!!Instance An instance of the action class
547 * @throws Invalid|||Exception Thrown if $!!!Name is invalid
549 public function resolve||| () {
550 // Initiate the instance variable
554 $!!!Name = $this->get|||Name();
556 // Is the action empty? Then fall back to default action
557 if (empty($!!!Name)) {
558 $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action');
561 // Check if action is valid
562 if ($this->is|||Valid($!!!Name) === false) {
563 // This action is invalid!
564 throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
568 $!!!Instance = $this->load|||();
570 // Return the instance