- public function isCommandValid ($commandName) {
- // By default nothing shall be valid
- $isValid = false;
-
- // Is a command set?
- if (empty($commandName)) {
- // Then thrown an exception here
- throw new EmptyVariableException(array($this, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- }
-
- // Now, let us create the full name of the command class
- $class = sprintf("%s%sCommand",
- $this->commandPrefix,
- ucfirst(strtolower($commandName))
- );
-
- // Is this class already loaded?
- if (class_exists($class)) {
- // This class does exist. :-)
- $isValid = true;
- }
-
- // Set command name
- $this->setCommandName($commandName);
-
- // Return the result
- return $isValid;