]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/resolver/command/console/class_ConsoleCommandResolver.php
Host name fixed (a redirect causes an error), duplicate code rewrriten to be more...
[core.git] / inc / classes / main / resolver / command / console / class_ConsoleCommandResolver.php
index 6611129a7a7b9a7027c88a321091dd1e5b9703b9..8aefd8cfe48f7c79f15e3a66128525c18a4ad30a 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 class ConsoleCommandResolver extends BaseCommandResolver implements CommandResolver {
-       /**
-        * Last successfull resolved command
-        */
-       private $lastCommandInstance = null;
-
        /**
         * Protected constructor
         *
@@ -37,7 +32,7 @@ class ConsoleCommandResolver extends BaseCommandResolver implements CommandResol
                parent::__construct(__CLASS__);
 
                // Set prefix to "Console"
-               $this->setCommandPrefix('Console');
+               $this->setClassPrefix('Console');
        }
 
        /**
@@ -89,7 +84,9 @@ class ConsoleCommandResolver extends BaseCommandResolver implements CommandResol
                $commandName = $requestInstance->getRequestElement('command');
 
                // Is the command empty? Then fall back to default command
-               if (empty($commandName)) $commandName = $this->getConfigInstance()->getConfigEntry('default_console_command');
+               if (empty($commandName)) {
+                       $commandName = $this->getConfigInstance()->getConfigEntry('default_console_command');
+               } // END - if
 
                // Check if command is valid
                if ($this->isCommandValid($commandName) === false) {
@@ -107,7 +104,7 @@ class ConsoleCommandResolver extends BaseCommandResolver implements CommandResol
                } // END - if
 
                // Set last command
-               $this->lastCommandInstance = $commandInstance;
+               $this->setResolvedInstance($commandInstance);
 
                // Return the resolved command instance
                return $commandInstance;
@@ -125,13 +122,15 @@ class ConsoleCommandResolver extends BaseCommandResolver implements CommandResol
                $commandInstance = null;
 
                // Is the command empty? Then fall back to default command
-               if (empty($commandName)) $commandName = $this->getConfigInstance()->getConfigEntry('default_console_command');
+               if (empty($commandName)) {
+                       $commandName = $this->getConfigInstance()->getConfigEntry('default_console_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);
@@ -153,7 +152,7 @@ class ConsoleCommandResolver extends BaseCommandResolver implements CommandResol
                $commandInstance = null;
 
                // Create class name
-               $className = $this->getCommandPrefix() . $this->convertToClassName($commandName) . 'Command';
+               $className = $this->getClassPrefix() . $this->convertToClassName($commandName) . 'Command';
 
                // Create command class name
                $this->setClassName($className);