4 * @TODO Clean up this template
6 * @author Roland Haeder <webmaster@ship-simu.org>
8 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
9 * @license GNU GPL 3.0 or any newer version
10 * @link http://www.ship-simu.org
12 * This program is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation, either version 3 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 class ???Resolver extends BaseResolver implements Resolver {
27 * Protected constructor
31 protected function __construct () {
32 // Call parent constructor
33 parent::__construct(__CLASS__);
35 // Set prefix to '???'
36 $this->setClassPrefix('???');
40 * Creates an instance of a Web action resolver with a given default action
42 * @param $!!!Name The default action we shall execute
43 * @param $appInstance An instance of a manageable application helper class
44 * @return $resolverInstance The prepared action resolver instance
45 * @throws EmptyVariableException Thrown if default action is not set
46 * @throws Invalid|||Exception Thrown if default action is invalid
48 public static final function create???Resolver ($!!!Name, ManageableApplication $appInstance) {
49 // Create the new instance
50 $resolverInstance = new ???Resolver();
52 // Is the variable $!!!Name set and the action is valid?
53 if (empty($!!!Name)) {
54 // Then thrown an exception here
55 throw new EmptyVariableException(array($resolverInstance, 'default|||'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
56 } elseif ($resolverInstance->is|||Valid($!!!Name) === FALSE) {
57 // Invalid action found
58 throw new Invalid|||Exception(array($resolverInstance, $!!!Name), self::EXCEPTION_INVALID_ACTION);
61 // Set the application instance
62 $resolverInstance->setApplicationInstance($appInstance);
64 // Return the prepared instance
65 return $resolverInstance;
69 * Returns an action instance for a given request class or null if
72 * @param $requestInstance An instance of a request class
73 * @return $!!!Instance An instance of the resolved action
74 * @throws Invalid|||Exception Thrown if $!!!Name is
76 * @throws Invalid|||InstanceException Thrown if $!!!Instance
77 * is an invalid instance
79 public function resolve|||ByRequest (Requestable $requestInstance) {
84 // This goes fine so let's resolve the action
85 $!!!Name = $requestInstance->getRequestElement('action');
87 // Is the action empty? Then fall back to default action
88 if (empty($!!!Name)) $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action');
90 // Check if action is valid
91 if ($this->is|||Valid($!!!Name) === FALSE) {
92 // This action is invalid!
93 throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
97 $!!!Instance = $this->load|||();
100 if ((!is_object($!!!Instance)) || (!$!!!Instance instanceof |||able)) {
101 // This action has an invalid instance!
102 throw new Invalid|||InstanceException(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
106 $this->setResolvedInstance($!!!Instance);
108 // Return the resolved action instance
113 * Resolves the action by its direct name and returns an instance of its class
115 * @return $!!!Instance An instance of the action class
116 * @throws Invalid|||Exception Thrown if $!!!Name is invalid
118 public function resolve||| () {
119 // Initiate the instance variable
123 $!!!Name = $this->get|||Name();
125 // Is the action empty? Then fall back to default action
126 if (empty($!!!Name)) {
127 $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action');
130 // Check if action is valid
131 if ($this->is|||Valid($!!!Name) === FALSE) {
132 // This action is invalid!
133 throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
137 $!!!Instance = $this->load|||();
139 // Return the instance
150 * @author Roland Haeder <webmaster@ship-simu.org>
152 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
153 * @license GNU GPL 3.0 or any newer version
154 * @link http://www.ship-simu.org
156 * This program is free software: you can redistribute it and/or modify
157 * it under the terms of the GNU General Public License as published by
158 * the Free Software Foundation, either version 3 of the License, or
159 * (at your option) any later version.
161 * This program is distributed in the hope that it will be useful,
162 * but WITHOUT ANY WARRANTY; without even the implied warranty of
163 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
164 * GNU General Public License for more details.
166 * You should have received a copy of the GNU General Public License
167 * along with this program. If not, see <http://www.gnu.org/licenses/>.
169 class ???Resolver extends BaseResolver implements Resolver {
171 * Protected constructor
175 protected function __construct () {
176 // Call parent constructor
177 parent::__construct(__CLASS__);
179 // Set prefix to '???'
180 $this->setClassPrefix('???');
184 * Creates an instance of a Web action resolver with a given default action
186 * @param $!!!Name The default action we shall execute
187 * @param $appInstance An instance of a manageable application helper class
188 * @return $resolverInstance The prepared action resolver instance
189 * @throws EmptyVariableException Thrown if default action is not set
190 * @throws Invalid|||Exception Thrown if default action is invalid
192 public static final function create???Resolver ($!!!Name, ManageableApplication $appInstance) {
193 // Create the new instance
194 $resolverInstance = new ???Resolver();
196 // Is the variable $!!!Name set and the action is valid?
197 if (empty($!!!Name)) {
198 // Then thrown an exception here
199 throw new EmptyVariableException(array($resolverInstance, 'default|||'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
200 } elseif ($resolverInstance->is|||Valid($!!!Name) === FALSE) {
201 // Invalid action found
202 throw new Invalid|||Exception(array($resolverInstance, $!!!Name), self::EXCEPTION_INVALID_ACTION);
205 // Set the application instance
206 $resolverInstance->setApplicationInstance($appInstance);
208 // Return the prepared instance
209 return $resolverInstance;
213 * Returns an action instance for a given request class or null if
216 * @param $requestInstance An instance of a request class
217 * @return $!!!Instance An instance of the resolved action
218 * @throws Invalid|||Exception Thrown if $!!!Name is
220 * @throws Invalid|||InstanceException Thrown if $!!!Instance
221 * is an invalid instance
223 public function resolve|||ByRequest (Requestable $requestInstance) {
228 // This goes fine so let's resolve the action
229 $!!!Name = $requestInstance->getRequestElement('action');
231 // Is the action empty? Then fall back to default action
232 if (empty($!!!Name)) $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action');
234 // Check if action is valid
235 if ($this->is|||Valid($!!!Name) === FALSE) {
236 // This action is invalid!
237 throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
241 $!!!Instance = $this->load|||();
244 if ((!is_object($!!!Instance)) || (!$!!!Instance instanceof |||able)) {
245 // This action has an invalid instance!
246 throw new Invalid|||InstanceException(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
250 $this->setResolvedInstance($!!!Instance);
252 // Return the resolved action instance
257 * Resolves the action by its direct name and returns an instance of its class
259 * @return $!!!Instance An instance of the action class
260 * @throws Invalid|||Exception Thrown if $!!!Name is invalid
262 public function resolve||| () {
263 // Initiate the instance variable
267 $!!!Name = $this->get|||Name();
269 // Is the action empty? Then fall back to default action
270 if (empty($!!!Name)) {
271 $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action');
274 // Check if action is valid
275 if ($this->is|||Valid($!!!Name) === FALSE) {
276 // This action is invalid!
277 throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
281 $!!!Instance = $this->load|||();
283 // Return the instance
294 * @author Roland Haeder <webmaster@ship-simu.org>
296 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
297 * @license GNU GPL 3.0 or any newer version
298 * @link http://www.ship-simu.org
300 * This program is free software: you can redistribute it and/or modify
301 * it under the terms of the GNU General Public License as published by
302 * the Free Software Foundation, either version 3 of the License, or
303 * (at your option) any later version.
305 * This program is distributed in the hope that it will be useful,
306 * but WITHOUT ANY WARRANTY; without even the implied warranty of
307 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
308 * GNU General Public License for more details.
310 * You should have received a copy of the GNU General Public License
311 * along with this program. If not, see <http://www.gnu.org/licenses/>.
313 class ???Resolver extends BaseResolver implements Resolver {
315 * Protected constructor
319 protected function __construct () {
320 // Call parent constructor
321 parent::__construct(__CLASS__);
323 // Set prefix to '???'
324 $this->setClassPrefix('???');
328 * Creates an instance of a Web action resolver with a given default action
330 * @param $!!!Name The default action we shall execute
331 * @param $appInstance An instance of a manageable application helper class
332 * @return $resolverInstance The prepared action resolver instance
333 * @throws EmptyVariableException Thrown if default action is not set
334 * @throws Invalid|||Exception Thrown if default action is invalid
336 public static final function create???Resolver ($!!!Name, ManageableApplication $appInstance) {
337 // Create the new instance
338 $resolverInstance = new ???Resolver();
340 // Is the variable $!!!Name set and the action is valid?
341 if (empty($!!!Name)) {
342 // Then thrown an exception here
343 throw new EmptyVariableException(array($resolverInstance, 'default|||'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
344 } elseif ($resolverInstance->is|||Valid($!!!Name) === FALSE) {
345 // Invalid action found
346 throw new Invalid|||Exception(array($resolverInstance, $!!!Name), self::EXCEPTION_INVALID_ACTION);
349 // Set the application instance
350 $resolverInstance->setApplicationInstance($appInstance);
352 // Return the prepared instance
353 return $resolverInstance;
357 * Returns an action instance for a given request class or null if
360 * @param $requestInstance An instance of a request class
361 * @return $!!!Instance An instance of the resolved action
362 * @throws Invalid|||Exception Thrown if $!!!Name is
364 * @throws Invalid|||InstanceException Thrown if $!!!Instance
365 * is an invalid instance
367 public function resolve|||ByRequest (Requestable $requestInstance) {
372 // This goes fine so let's resolve the action
373 $!!!Name = $requestInstance->getRequestElement('action');
375 // Is the action empty? Then fall back to default action
376 if (empty($!!!Name)) $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action');
378 // Check if action is valid
379 if ($this->is|||Valid($!!!Name) === FALSE) {
380 // This action is invalid!
381 throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
385 $!!!Instance = $this->load|||();
388 if ((!is_object($!!!Instance)) || (!$!!!Instance instanceof |||able)) {
389 // This action has an invalid instance!
390 throw new Invalid|||InstanceException(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
394 $this->setResolvedInstance($!!!Instance);
396 // Return the resolved action instance
401 * Resolves the action by its direct name and returns an instance of its class
403 * @return $!!!Instance An instance of the action class
404 * @throws Invalid|||Exception Thrown if $!!!Name is invalid
406 public function resolve||| () {
407 // Initiate the instance variable
411 $!!!Name = $this->get|||Name();
413 // Is the action empty? Then fall back to default action
414 if (empty($!!!Name)) {
415 $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action');
418 // Check if action is valid
419 if ($this->is|||Valid($!!!Name) === FALSE) {
420 // This action is invalid!
421 throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
425 $!!!Instance = $this->load|||();
427 // Return the instance
438 * @author Roland Haeder <webmaster@ship-simu.org>
440 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
441 * @license GNU GPL 3.0 or any newer version
442 * @link http://www.ship-simu.org
444 * This program is free software: you can redistribute it and/or modify
445 * it under the terms of the GNU General Public License as published by
446 * the Free Software Foundation, either version 3 of the License, or
447 * (at your option) any later version.
449 * This program is distributed in the hope that it will be useful,
450 * but WITHOUT ANY WARRANTY; without even the implied warranty of
451 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
452 * GNU General Public License for more details.
454 * You should have received a copy of the GNU General Public License
455 * along with this program. If not, see <http://www.gnu.org/licenses/>.
457 class ???Resolver extends BaseResolver implements Resolver {
459 * Protected constructor
463 protected function __construct () {
464 // Call parent constructor
465 parent::__construct(__CLASS__);
467 // Set prefix to '???'
468 $this->setClassPrefix('???');
472 * Creates an instance of a Web action resolver with a given default action
474 * @param $!!!Name The default action we shall execute
475 * @param $appInstance An instance of a manageable application helper class
476 * @return $resolverInstance The prepared action resolver instance
477 * @throws EmptyVariableException Thrown if default action is not set
478 * @throws Invalid|||Exception Thrown if default action is invalid
480 public static final function create???Resolver ($!!!Name, ManageableApplication $appInstance) {
481 // Create the new instance
482 $resolverInstance = new ???Resolver();
484 // Is the variable $!!!Name set and the action is valid?
485 if (empty($!!!Name)) {
486 // Then thrown an exception here
487 throw new EmptyVariableException(array($resolverInstance, 'default|||'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
488 } elseif ($resolverInstance->is|||Valid($!!!Name) === FALSE) {
489 // Invalid action found
490 throw new Invalid|||Exception(array($resolverInstance, $!!!Name), self::EXCEPTION_INVALID_ACTION);
493 // Set the application instance
494 $resolverInstance->setApplicationInstance($appInstance);
496 // Return the prepared instance
497 return $resolverInstance;
501 * Returns an action instance for a given request class or null if
504 * @param $requestInstance An instance of a request class
505 * @return $!!!Instance An instance of the resolved action
506 * @throws Invalid|||Exception Thrown if $!!!Name is
508 * @throws Invalid|||InstanceException Thrown if $!!!Instance
509 * is an invalid instance
511 public function resolve|||ByRequest (Requestable $requestInstance) {
516 // This goes fine so let's resolve the action
517 $!!!Name = $requestInstance->getRequestElement('action');
519 // Is the action empty? Then fall back to default action
520 if (empty($!!!Name)) $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action');
522 // Check if action is valid
523 if ($this->is|||Valid($!!!Name) === FALSE) {
524 // This action is invalid!
525 throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
529 $!!!Instance = $this->load|||();
532 if ((!is_object($!!!Instance)) || (!$!!!Instance instanceof |||able)) {
533 // This action has an invalid instance!
534 throw new Invalid|||InstanceException(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
538 $this->setResolvedInstance($!!!Instance);
540 // Return the resolved action instance
545 * Resolves the action by its direct name and returns an instance of its class
547 * @return $!!!Instance An instance of the action class
548 * @throws Invalid|||Exception Thrown if $!!!Name is invalid
550 public function resolve||| () {
551 // Initiate the instance variable
555 $!!!Name = $this->get|||Name();
557 // Is the action empty? Then fall back to default action
558 if (empty($!!!Name)) {
559 $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action');
562 // Check if action is valid
563 if ($this->is|||Valid($!!!Name) === FALSE) {
564 // This action is invalid!
565 throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION);
569 $!!!Instance = $this->load|||();
571 // Return the instance