]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/resolver/command/web/class_WebCommandResolver.php
Host name fixed (a redirect causes an error), duplicate code rewrriten to be more...
[core.git] / inc / classes / main / resolver / command / web / class_WebCommandResolver.php
index da0c35a67fc3ec2dc5ac6816f4ccba264d811384..a19ff10c463f86b3ce814e56b4190547daf66012 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
  *
@@ -37,7 +37,7 @@ class WebCommandResolver extends BaseCommandResolver implements CommandResolver
                parent::__construct(__CLASS__);
 
                // Set prefix to "Web"
-               $this->setCommandPrefix("Web");
+               $this->setClassPrefix('Web');
        }
 
        /**
@@ -49,7 +49,7 @@ class WebCommandResolver extends BaseCommandResolver implements CommandResolver
         * @throws      EmptyVariableException          Thrown if default command is not set
         * @throws      InvalidCommandException         Thrown if default command is invalid
         */
-       public final static function createWebCommandResolver ($commandName, ManageableApplication $appInstance) {
+       public static final function createWebCommandResolver ($commandName, ManageableApplication $appInstance) {
                // Create the new instance
                $resolverInstance = new WebCommandResolver();
 
@@ -89,7 +89,9 @@ class WebCommandResolver extends BaseCommandResolver implements CommandResolver
                $commandName = $requestInstance->getRequestElement('page');
 
                // Is the command empty? Then fall back to default command
-               if (empty($commandName)) $commandName = $this->getConfigInstance()->getConfigEntry('default_web_command');
+               if (empty($commandName)) {
+                       $commandName = $this->getConfigInstance()->getConfigEntry('default_web_command');
+               } // END - if
 
                // Check if command is valid
                if ($this->isCommandValid($commandName) === false) {
@@ -107,7 +109,7 @@ class WebCommandResolver extends BaseCommandResolver implements CommandResolver
                } // END - if
 
                // Set last command
-               $this->lastCommandInstance = $commandInstance;
+               $this->setResolvedInstance($commandInstance);
 
                // Return the resolved command instance
                return $commandInstance;
@@ -125,13 +127,15 @@ class WebCommandResolver extends BaseCommandResolver implements CommandResolver
                $commandInstance = null;
 
                // Is the command empty? Then fall back to default command
-               if (empty($commandName)) $commandName = $this->getConfigInstance()->getConfigEntry('default_web_command');
+               if (empty($commandName)) {
+                       $commandName = $this->getConfigInstance()->getConfigEntry('default_web_command');
+               } // END - if
 
                // Check if command is valid
                if ($this->isCommandValid($commandName) === false) {
                        // This command is invalid!
                        throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
-               }
+               } // END - if
 
                // Get the command
                $commandInstance = $this->loadCommand($commandName);
@@ -152,12 +156,6 @@ class WebCommandResolver extends BaseCommandResolver implements CommandResolver
                // Init command instance
                $commandInstance = null;
 
-               // Create class name
-               $className = 'Web' . $this->convertToClassName($commandName) . 'Command';
-
-               // Create command class name
-               $this->setClassName($className);
-
                // Is this class loaded?
                if (!class_exists($this->getClassName())) {
                        // Class not found, so throw an exception