]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/resolver/command/class_BaseCommandResolver.php
Continued:
[core.git] / framework / main / classes / resolver / command / class_BaseCommandResolver.php
index 0db8170f08a6ec9dab990b449c90cea069e020c7..a7f0e916db16a27b780997c74cf4927b03d481bd 100644 (file)
@@ -1,14 +1,14 @@
 <?php
 // Own namespace
-namespace CoreFramework\Resolver\Command;
+namespace Org\Mxchange\CoreFramework\Resolver\Command;
 
 // Import framework stuff
-use CoreFramework\Bootstrap\FrameworkBootstrap;
-use CoreFramework\Command\Commandable;
-use CoreFramework\Command\InvalidCommandException;
-use CoreFramework\Factory\ObjectFactory;
-use CoreFramework\Request\Requestable;
-use CoreFramework\Resolver\BaseResolver;
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Command\Commandable;
+use Org\Mxchange\CoreFramework\Command\InvalidCommandException;
+use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Request\Requestable;
+use Org\Mxchange\CoreFramework\Resolver\BaseResolver;
 
 // Import SPL stuff
 use \InvalidArgumentException;
@@ -19,7 +19,7 @@ use \UnexpectedValueException;
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  *
@@ -36,7 +36,7 @@ use \UnexpectedValueException;
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-class BaseCommandResolver extends BaseResolver {
+abstract class BaseCommandResolver extends BaseResolver {
        /**
         * Protected constructor
         *
@@ -131,21 +131,32 @@ class BaseCommandResolver extends BaseResolver {
        /**
         * Resolves the command by its direct name and returns an instance of its class
         *
+        * @param       $namespace                      Namespace to look in
         * @param       $commandName            The direct command name we shall resolve
         * @return      $commandInstance        An instance of the command class
         * @throws      InvalidCommandException         Thrown if $commandName is invalid
         */
-       public function resolveCommand ($commandName) {
+       public function resolveCommand ($namespace, $commandName) {
+               // Is a action set?
+               if (empty($namespace)) {
+                       // Then thrown an exception here
+                       throw new InvalidArgumentException('Parameter "namespace" is empty');
+               } elseif (empty($actionName)) {
+                       // Then thrown an exception here
+                       throw new InvalidArgumentException('Parameter "actionName" is empty');
+               }
+
                // Initiate the instance variable
                $commandInstance = NULL;
 
                // Is the command empty? Then fall back to default command
                if (empty($commandName)) {
+                       // Init default command
                        $commandName = $this->getConfigInstance()->getConfigEntry('default_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_command');
                } // END - if
 
                // Check if command is valid
-               if ($this->isCommandValid($commandName) === false) {
+               if ($this->isCommandValid($namespace, $commandName) === false) {
                        // This command is invalid!
                        throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
                } // END - if