3 * A command resolver for local (non-hubbed) HTML commands
5 * @author Roland Haeder <webmaster@ship-simu.org>
7 <<<<<<< HEAD:framework/main/classes/resolver/command/html/class_Html
8 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
10 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2016 Core Developer Team
11 >>>>>>> Some updates::inc/main/classes/resolver/command/html/class_Html
12 * @license GNU GPL 3.0 or any newer version
13 * @link http://www.ship-simu.org
15 * This program is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation, either version 3 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program. If not, see <http://www.gnu.org/licenses/>.
28 class Html???CommandResolver extends BaseCommandResolver implements CommandResolver {
30 * Last successfull resolved command
32 private $lastCommandInstance = null;
35 * Protected constructor
39 protected function __construct () {
40 // Call parent constructor
41 parent::__construct(__CLASS__);
43 // Set prefix to 'html'
44 $this->setCommandPrefix('html');
48 * Creates an instance of a Html command resolver with a given default command
50 * @param $commandName The default command we shall execute
51 * @param $appInstance An instance of a manageable application helper class
52 * @return $resolverInstance The prepared command resolver instance
53 * @throws EmptyVariableException Thrown if the default command is not set
54 * @throws InvalidCommandException Thrown if the default command is invalid
56 public final static function createHtml???CommandResolver ($commandName, ManageableApplication $appInstance) {
57 // Create the new instance
58 $resolverInstance = new Html???CommandResolver();
60 // Is the variable $commandName set and the command is valid?
61 if (empty($commandName)) {
62 // Then thrown an exception here
63 throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
64 } elseif ($resolverInstance->isCommandValid($commandName) === false) {
65 // Invalid command found
66 throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND);
69 // Set the application instance
70 $resolverInstance->setApplicationInstance($appInstance);
72 // Return the prepared instance
73 return $resolverInstance;