* 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
*
parent::__construct(__CLASS__);
// Set prefix to "Console"
- $this->setCommandPrefix('Console');
+ $this->setClassPrefix('Console');
}
/**
$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) {
} // END - if
// Set last command
- $this->lastCommandInstance = $commandInstance;
+ $this->setResolvedInstance($commandInstance);
// Return the resolved command instance
return $commandInstance;
$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);
$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);