From a5841c2444775cb682ae962d6878439b75c8b211 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Mon, 23 Mar 2015 17:04:30 +0100 Subject: [PATCH] Renamed more from 'web' to 'html'. Signed-off-by: Roland Haeder --- .../main/controller/{web => html}/.htaccess | 0 .../class_HtmlCompanyController.php} | 6 +- .../class_HtmlGovernmentFailedController.php} | 6 +- .../main/resolver/{web => command}/.htaccess | 0 .../main/resolver/command/html/.htaccess | 1 + .../class_HtmlCompanyCommandResolver.php} | 14 +-- ...s_HtmlGovernmentFailedCommandResolver.php} | 16 +-- .../main/resolver/controller/.htaccess | 1 + .../main/resolver/controller/html/.htaccess | 1 + .../class_ShipSimuHtmlControllerResolver.php | 104 ++++++++++++++++++ 10 files changed, 128 insertions(+), 21 deletions(-) rename application/shipsimu/main/controller/{web => html}/.htaccess (100%) rename application/shipsimu/main/controller/{web/class_WebCompanyController.php => html/class_HtmlCompanyController.php} (93%) rename application/shipsimu/main/controller/{web/class_WebGovernmentFailedController.php => html/class_HtmlGovernmentFailedController.php} (92%) rename application/shipsimu/main/resolver/{web => command}/.htaccess (100%) create mode 100644 application/shipsimu/main/resolver/command/html/.htaccess rename application/shipsimu/main/resolver/{web/class_WebCompanyCommandResolver.php => command/html/class_HtmlCompanyCommandResolver.php} (93%) rename application/shipsimu/main/resolver/{web/class_WebGovernmentFailedCommandResolver.php => command/html/class_HtmlGovernmentFailedCommandResolver.php} (91%) create mode 100644 application/shipsimu/main/resolver/controller/.htaccess create mode 100644 application/shipsimu/main/resolver/controller/html/.htaccess create mode 100644 application/shipsimu/main/resolver/controller/html/class_ShipSimuHtmlControllerResolver.php diff --git a/application/shipsimu/main/controller/web/.htaccess b/application/shipsimu/main/controller/html/.htaccess similarity index 100% rename from application/shipsimu/main/controller/web/.htaccess rename to application/shipsimu/main/controller/html/.htaccess diff --git a/application/shipsimu/main/controller/web/class_WebCompanyController.php b/application/shipsimu/main/controller/html/class_HtmlCompanyController.php similarity index 93% rename from application/shipsimu/main/controller/web/class_WebCompanyController.php rename to application/shipsimu/main/controller/html/class_HtmlCompanyController.php index c5f1e2d..741cc5a 100644 --- a/application/shipsimu/main/controller/web/class_WebCompanyController.php +++ b/application/shipsimu/main/controller/html/class_HtmlCompanyController.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class WebCompanyController extends BaseController implements Controller { +class HtmlCompanyController extends BaseController implements Controller { /** * Protected constructor * @@ -39,9 +39,9 @@ class WebCompanyController extends BaseController implements Controller { * @return $controllerInstance A prepared instance of this class * @todo Add some filters to this controller */ - public static final function createWebCompanyController (CommandResolver $resolverInstance) { + public static final function createHtmlCompanyController (CommandResolver $resolverInstance) { // Create the instance - $controllerInstance = new WebCompanyController(); + $controllerInstance = new HtmlCompanyController(); // Set the command resolver $controllerInstance->setResolverInstance($resolverInstance); diff --git a/application/shipsimu/main/controller/web/class_WebGovernmentFailedController.php b/application/shipsimu/main/controller/html/class_HtmlGovernmentFailedController.php similarity index 92% rename from application/shipsimu/main/controller/web/class_WebGovernmentFailedController.php rename to application/shipsimu/main/controller/html/class_HtmlGovernmentFailedController.php index c51bf1c..217b6b5 100644 --- a/application/shipsimu/main/controller/web/class_WebGovernmentFailedController.php +++ b/application/shipsimu/main/controller/html/class_HtmlGovernmentFailedController.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class WebGovernmentFailedController extends BaseController implements Controller { +class HtmlGovernmentFailedController extends BaseController implements Controller { /** * Protected constructor * @@ -39,9 +39,9 @@ class WebGovernmentFailedController extends BaseController implements Controller * @return $controllerInstance A prepared instance of this class * @todo Add some filters to this controller */ - public static final function createWebGovernmentFailedController (CommandResolver $resolverInstance) { + public static final function createHtmlGovernmentFailedController (CommandResolver $resolverInstance) { // Create the instance - $controllerInstance = new WebGovernmentFailedController(); + $controllerInstance = new HtmlGovernmentFailedController(); // Set the command resolver $controllerInstance->setResolverInstance($resolverInstance); diff --git a/application/shipsimu/main/resolver/web/.htaccess b/application/shipsimu/main/resolver/command/.htaccess similarity index 100% rename from application/shipsimu/main/resolver/web/.htaccess rename to application/shipsimu/main/resolver/command/.htaccess diff --git a/application/shipsimu/main/resolver/command/html/.htaccess b/application/shipsimu/main/resolver/command/html/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/main/resolver/command/html/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/main/resolver/web/class_WebCompanyCommandResolver.php b/application/shipsimu/main/resolver/command/html/class_HtmlCompanyCommandResolver.php similarity index 93% rename from application/shipsimu/main/resolver/web/class_WebCompanyCommandResolver.php rename to application/shipsimu/main/resolver/command/html/class_HtmlCompanyCommandResolver.php index e5fcfb4..e04768c 100644 --- a/application/shipsimu/main/resolver/web/class_WebCompanyCommandResolver.php +++ b/application/shipsimu/main/resolver/command/html/class_HtmlCompanyCommandResolver.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class WebCompanyCommandResolver extends BaseCommandResolver implements CommandResolver { +class HtmlCompanyCommandResolver extends BaseCommandResolver implements CommandResolver { /** * Last successfull resolved command */ @@ -36,12 +36,12 @@ class WebCompanyCommandResolver extends BaseCommandResolver implements CommandRe // Call parent constructor parent::__construct(__CLASS__); - // Set prefix to "Web" - $this->setCommandPrefix('Web'); + // Set prefix to "Html" + $this->setCommandPrefix('Html'); } /** - * Creates an instance of a Web command resolver with a given default command + * Creates an instance of a Html command resolver with a given default command * * @param $commandName The default command we shall execute * @param $appInstance An instance of a manageable application helper class @@ -49,9 +49,9 @@ class WebCompanyCommandResolver extends BaseCommandResolver implements CommandRe * @throws EmptyVariableException Thrown if default command is not set * @throws InvalidInterfaceException Thrown if command does not implement interface Commandable */ - public static final function createWebCompanyCommandResolver ($commandName, ManageableApplication $appInstance) { + public static final function createHtmlCompanyCommandResolver ($commandName, ManageableApplication $appInstance) { // Create the new instance - $resolverInstance = new WebCompanyCommandResolver(); + $resolverInstance = new HtmlCompanyCommandResolver(); // Get request instance $requestInstance = $appInstance->getRequestInstance(); @@ -167,7 +167,7 @@ class WebCompanyCommandResolver extends BaseCommandResolver implements CommandRe $app = Registry::getRegistry()->getInstance('application')->getRequestInstance()->getRequestElement('app'); // Create command class name - $this->setClassName(sprintf("%s%sCommand", + $this->setClassName(sprintf('%s%sCommand', $this->getCommandPrefix(), $this->convertToClassName($commandName) )); diff --git a/application/shipsimu/main/resolver/web/class_WebGovernmentFailedCommandResolver.php b/application/shipsimu/main/resolver/command/html/class_HtmlGovernmentFailedCommandResolver.php similarity index 91% rename from application/shipsimu/main/resolver/web/class_WebGovernmentFailedCommandResolver.php rename to application/shipsimu/main/resolver/command/html/class_HtmlGovernmentFailedCommandResolver.php index 9456c08..a83f222 100644 --- a/application/shipsimu/main/resolver/web/class_WebGovernmentFailedCommandResolver.php +++ b/application/shipsimu/main/resolver/command/html/class_HtmlGovernmentFailedCommandResolver.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class WebGovernmentFailedCommandResolver extends BaseCommandResolver implements CommandResolver { +class HtmlGovernmentFailedCommandResolver extends BaseCommandResolver implements CommandResolver { /** * Last successfull resolved command */ @@ -36,12 +36,12 @@ class WebGovernmentFailedCommandResolver extends BaseCommandResolver implements // Call parent constructor parent::__construct(__CLASS__); - // Set prefix to "Web" - $this->setCommandPrefix('Web'); + // Set prefix to "Html" + $this->setCommandPrefix('Html'); } /** - * Creates an instance of a Web command resolver with a given default command + * Creates an instance of a Html command resolver with a given default command * * @param $commandName The default command we shall execute * @param $appInstance An instance of a manageable application helper class @@ -49,9 +49,9 @@ class WebGovernmentFailedCommandResolver extends BaseCommandResolver implements * @throws EmptyVariableException Thrown if default command is not set * @throws InvalidInterfaceException Thrown if command does not implement interface Commandable */ - public static final function createWebGovernmentFailedCommandResolver ($commandName, ManageableApplication $appInstance) { + public static final function createHtmlGovernmentFailedCommandResolver ($commandName, ManageableApplication $appInstance) { // Create the new instance - $resolverInstance = new WebGovernmentFailedCommandResolver(); + $resolverInstance = new HtmlGovernmentFailedCommandResolver(); // Get request instance $requestInstance = $appInstance->getRequestInstance(); @@ -93,7 +93,7 @@ class WebGovernmentFailedCommandResolver extends BaseCommandResolver implements // Is there a "failed" request? if ($requestInstance->isRequestElementSet('failed')) { // Then include with within the command name - $commandName = sprintf("%s_%s", $commandName, $requestInstance->getRequestElement('failed')); + $commandName = sprintf('%s_%s', $commandName, $requestInstance->getRequestElement('failed')); } // END - if // Is the command empty? Then fall back to default command @@ -164,7 +164,7 @@ class WebGovernmentFailedCommandResolver extends BaseCommandResolver implements $commandInstance = null; // Create command class name - $this->setClassName(sprintf("%s%sCommand", + $this->setClassName(sprintf('%s%sCommand', $this->getCommandPrefix(), $this->convertToClassName($commandName) )); diff --git a/application/shipsimu/main/resolver/controller/.htaccess b/application/shipsimu/main/resolver/controller/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/main/resolver/controller/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/main/resolver/controller/html/.htaccess b/application/shipsimu/main/resolver/controller/html/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/main/resolver/controller/html/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/main/resolver/controller/html/class_ShipSimuHtmlControllerResolver.php b/application/shipsimu/main/resolver/controller/html/class_ShipSimuHtmlControllerResolver.php new file mode 100644 index 0000000..9f18f22 --- /dev/null +++ b/application/shipsimu/main/resolver/controller/html/class_ShipSimuHtmlControllerResolver.php @@ -0,0 +1,104 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class ShipSimuHtmlControllerResolver extends BaseControllerResolver implements ControllerResolver { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Set prefix to 'ShipSimuHtml' + $this->setClassPrefix('ShipSimuHtml'); + } + + /** + * Creates an instance of a resolver class with a given command + * + * @param $controllerName The controller we shall resolve + * @param $applicationInstance An instance of a manageable application helper class + * @return $resolverInstance The prepared controller resolver instance + * @throws EmptyVariableException Thrown if default command is not set + * @throws InvalidControllerException Thrown if default controller is invalid + */ + public static final function createShipSimuHtmlControllerResolver ($controllerName, ManageableApplication $applicationInstance) { + // Create the new instance + $resolverInstance = new ShipSimuHtmlControllerResolver(); + + // Is the variable $controllerName set and the command is valid? + if (empty($controllerName)) { + // Then thrown an exception here + throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); + } elseif ($resolverInstance->isControllerValid($controllerName) === FALSE) { + // Invalid command found + throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER); + } + + // Set the application instance + $resolverInstance->setApplicationInstance($applicationInstance); + + // Set command name + $resolverInstance->setControllerName($controllerName); + + // Return the prepared instance + return $resolverInstance; + } + + /** + * Resolves the default controller of the given command + * + * @return $controllerInstance A controller instance for the default + * command + * @throws InvalidControllerInstanceException Thrown if $controllerInstance + * is invalid + */ + public function resolveController () { + // Init variables + $controllerName = ''; + $controllerInstance = NULL; + + // Get the command name + $controllerName = $this->getControllerName(); + + // Get the command + $controllerInstance = $this->loadController($controllerName); + + // And validate it + if ((!is_object($controllerInstance)) || (!$controllerInstance instanceof Controller)) { + // This command has an invalid instance! + throw new InvalidControllerInstanceException(array($this, $controllerName), self::EXCEPTION_INVALID_CONTROLLER); + } // END - if + + // Set last controller + $this->setResolvedInstance($controllerInstance); + + // Return the maybe resolved instance + return $controllerInstance; + } +} + +// [EOF] +?> -- 2.39.5