Class prefixes for actions, commands and controllers can now be like 'foo_bar'.
authorRoland Haeder <roland@mxchange.org>
Tue, 24 Mar 2015 19:27:36 +0000 (20:27 +0100)
committerRoland Haeder <roland@mxchange.org>
Tue, 24 Mar 2015 19:27:36 +0000 (20:27 +0100)
Signed-off-by: Roland H├Ąder <roland@mxchange.org>
inc/classes/main/resolver/action/class_BaseActionResolver.php
inc/classes/main/resolver/class_BaseResolver.php
inc/classes/main/resolver/command/class_BaseCommandResolver.php
inc/classes/main/resolver/command/console/class_ConsoleCommandResolver.php
inc/classes/main/resolver/command/image/class_ImageCommandResolver.php
inc/classes/main/resolver/controller/class_BaseControllerResolver.php

index f6fa435..c8daf00 100644 (file)
@@ -75,7 +75,7 @@ class BaseActionResolver extends BaseResolver {
                } // END - if
 
                // Create class name
-               $className = $this->getClassPrefix() . $this->convertToClassName($actionName) . 'Action';
+               $className = $this->getCapitalizedClassPrefix() . $this->convertToClassName($actionName) . 'Action';
 
                // Now, let us create the full name of the action class
                $this->setClassName($className);
@@ -103,7 +103,7 @@ class BaseActionResolver extends BaseResolver {
                $actionInstance = NULL;
 
                // Create action class name
-               $className = $this->getClassPrefix() . $this->convertToClassName($this->getActionName()) . 'Action';
+               $className = $this->getCapitalizedClassPrefix() . $this->convertToClassName($this->getActionName()) . 'Action';
 
                // ... and set it
                $this->setClassName($className);
index 4ed9dfb..1e9274f 100644 (file)
@@ -63,6 +63,22 @@ class BaseResolver extends BaseFrameworkSystem {
                return $this->className;
        }
 
+       /**
+        * "Getter" for class name (useable for an object factory)
+        *
+        * @return      $className      Capitalized class name
+        */
+       protected function getCapitalizedClassPrefix () {
+               // Get class name
+               $className = $this->getClassPrefix();
+
+               // And capitalize it
+               $className = $this->convertToClassName($className);
+
+               // Return it
+               return $className;
+       }
+
        /**
         * Setter for class name
         *
index 9446ed8..4d027b3 100644 (file)
@@ -75,7 +75,7 @@ class BaseCommandResolver extends BaseResolver {
                } // END - if
 
                // Create the full class name
-               $className = $this->getClassPrefix() . $this->convertToClassName($commandName) . 'Command';
+               $className = $this->getCapitalizedClassPrefix() . $this->convertToClassName($commandName) . 'Command';
 
                // Now, let us create the full name of the command class
                $this->setClassName($className);
index 079005b..ea1024b 100644 (file)
@@ -152,7 +152,7 @@ class ConsoleCommandResolver extends BaseCommandResolver implements CommandResol
                $commandInstance = NULL;
 
                // Create class name
-               $className = $this->getClassPrefix() . $this->convertToClassName($commandName) . 'Command';
+               $className = $this->getCapitalizedClassPrefix() . $this->convertToClassName($commandName) . 'Command';
 
                // Create command class name
                $this->setClassName($className);
index 6f4b1d2..b0fc8be 100644 (file)
@@ -157,7 +157,7 @@ class ImageCommandResolver extends BaseCommandResolver implements CommandResolve
                $commandInstance = NULL;
 
                // Create class name
-               $className = $this->getClassPrefix() . $this->convertToClassName($commandName) . 'Command';
+               $className = $this->getCapitalizedClassPrefix() . $this->convertToClassName($commandName) . 'Command';
 
                // Is this class loaded?
                if (!class_exists($this->getClassName())) {
index 3b2e443..0356054 100644 (file)
@@ -75,19 +75,19 @@ class BaseControllerResolver extends BaseResolver {
                $controllerInstance = NULL;
 
                // Default controller
-               $this->setClassName($this->getClassPrefix() . 'DefaultNewsController');
+               $this->setClassName($this->getCapitalizedClassPrefix() . 'DefaultNewsController');
 
                // Generate the class name
                //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('BEFORE: controller=' . $controllerName);
                if ($controllerName != $defaultController) {
                        // Create controller class name
-                       $className = $this->getClassPrefix() . $this->convertToClassName($controllerName) . 'Controller';
+                       $className = $this->getCapitalizedClassPrefix() . $this->convertToClassName($controllerName) . 'Controller';
 
                        // ... and set it
                        $this->setClassName($className);
                } else {
                        // No news at main command or non-news command
-                       $this->setClassName($this->getClassPrefix() . 'DefaultNewsController');
+                       $this->setClassName($this->getCapitalizedClassPrefix() . 'DefaultNewsController');
                }
                //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('AFTER: controller=' . $this->getClassName());
 
@@ -142,7 +142,7 @@ class BaseControllerResolver extends BaseResolver {
                } // END - if
 
                // Create class name
-               $className = $this->getClassPrefix() . $this->convertToClassName($controllerName) . 'Controller';
+               $className = $this->getCapitalizedClassPrefix() . $this->convertToClassName($controllerName) . 'Controller';
 
                // Now, let us create the full name of the controller class
                $this->setClassName($className);
@@ -153,9 +153,9 @@ class BaseControllerResolver extends BaseResolver {
                        if (class_exists($this->getClassName())) {
                                // This class does exist. :-)
                                $isValid = TRUE;
-                       } elseif ($this->getClassName() != $this->getClassPrefix() . 'DefaultNewsController') {
+                       } elseif ($this->getClassName() != $this->getCapitalizedClassPrefix() . 'DefaultNewsController') {
                                // Set default controller
-                               $this->setClassName($this->getClassPrefix() . 'DefaultNewsController');
+                               $this->setClassName($this->getCapitalizedClassPrefix() . 'DefaultNewsController');
                        } else {
                                // All is tried, give it up here
                                throw new DefaultControllerException($this, self::EXCEPTION_DEFAULT_CONTROLLER_GONE);