]> git.mxchange.org Git - core.git/commitdiff
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 f6fa4351711d58c3898a57dcb1d56f68e4f7f43c..c8daf0011809efbf66c25c04b92f5976d3001276 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 4ed9dfb851547c5c7bd83acb9dbc5b9cfcaedecd..1e9274f2654dca2d69073544e2cc3c2cacd02ed8 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 9446ed899658c78c890ac03ae7e478deae629f60..4d027b3751fb3905363a625d405a1faa169ffc4d 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 079005b9c9b9f928ac53c729628fa3a273bb3655..ea1024be5246f2413fffab91485775fb2358378f 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 6f4b1d2a35ddd4d850a26ef08402df2b133a18d7..b0fc8be66508aee9cb06d0c519b4af4860aa268d 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 3b2e44333d9510512b478ace488b12328441ca03..03560545d3c3178e081de2aa1affe3ff0962d319 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);