]> git.mxchange.org Git - core.git/commitdiff
Continued:
authorRoland Haeder <roland@mxchange.org>
Fri, 24 Feb 2017 21:10:34 +0000 (22:10 +0100)
committerRoland Haeder <roland@mxchange.org>
Tue, 28 Feb 2017 21:10:04 +0000 (22:10 +0100)
- no need to have namespace as parameter (only isValidFoo() calls) as it can be
  set in BaseResolver and all resolvers can use it which they must do anyway.
- added "import" for DefaultControllerException
- added "import" for Controller

Signed-off-by: Roland Häder <roland@mxchange.org>
21 files changed:
application/tests/classes/controller/console/class_TestsConsoleDefaultNewsController.php
application/tests/classes/resolver/controller/class_TestsConsoleControllerResolver.php
application/tests/config.php
inc/main/classes/controller/console/class_ConsoleDefaultNewsController.php
inc/main/classes/controller/html/class_HtmlConfirmController.php
inc/main/classes/controller/html/class_HtmlDefaultController.php
inc/main/classes/controller/html/class_HtmlDefaultNewsController.php
inc/main/classes/controller/html/class_HtmlLoginController.php
inc/main/classes/controller/html/class_HtmlLoginFailedController.php
inc/main/classes/controller/html/class_HtmlLogoutController.php
inc/main/classes/controller/html/class_HtmlLogoutDoneController.php
inc/main/classes/controller/html/class_HtmlProblemController.php
inc/main/classes/controller/html/class_HtmlRegisterController.php
inc/main/classes/controller/html/class_HtmlStatusController.php
inc/main/classes/controller/html/form/class_HtmlDoFormController.php
inc/main/classes/controller/html/login/class_HtmlLoginAreaController.php
inc/main/classes/controller/image/captcha/class_ImageCodeCaptchaController.php
inc/main/classes/controller/image/class_ImageDefaultController.php
inc/main/classes/resolver/class_BaseResolver.php
inc/main/classes/resolver/controller/class_BaseControllerResolver.php
inc/main/interfaces/controller/class_Controller.php

index 2f6e415387e9e5073e4b67aaecd3fcb3270c2616..266ee5424e0248dd9f2e8400b40b0decbd4c27c6 100644 (file)
@@ -4,6 +4,9 @@ namespace CoreFramework\Tests\Controller;
 
 // Import framework stuff
 use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
+use CoreFramework\Request\Requestable;
+use CoreFramework\Response\Responseable;
 
 /**
  * The default controller with news for e.g. home or news page
index 3c9023f5085f1af88ffc76ca641abe5f740aba93..f707e1f008c2b11b1472a9416f8059b1c234aad0 100644 (file)
@@ -61,7 +61,7 @@ class TestsConsoleControllerResolver extends BaseControllerResolver implements C
                if (empty($controllerName)) {
                        // Then thrown an exception here
                        throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
-               } elseif ($resolverInstance->isControllerValid(__NAMESPACE__, $controllerName) === FALSE) {
+               } elseif ($resolverInstance->isControllerValid('CoreFramework\Tests\Controller', $controllerName) === FALSE) {
                        // Invalid command found
                        throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
                }
@@ -69,7 +69,8 @@ class TestsConsoleControllerResolver extends BaseControllerResolver implements C
                // Set the application instance
                $resolverInstance->setApplicationInstance($applicationInstance);
 
-               // Set command name
+               // Set namespace and controller name
+               $resolverInstance->setNamespace('CoreFramework\Tests\Controller');
                $resolverInstance->setControllerName($controllerName);
 
                // Return the prepared instance
@@ -89,7 +90,7 @@ class TestsConsoleControllerResolver extends BaseControllerResolver implements C
                $controllerName = '';
                $controllerInstance = NULL;
 
-               // Get the command name 
+               // Get namespace and command name
                $controllerName = $this->getControllerName();
 
                // Get the command
index 3ed7924a47ed32fa1cc73a026c252efb2de574f8..c9653716506fe0cc7ea9691b086e8257f97800b2 100644 (file)
@@ -28,7 +28,10 @@ use CoreFramework\Configuration\FrameworkConfiguration;
 $cfg = FrameworkConfiguration::getSelfInstance();
 
 // CFG: DEFAULT-CONSOLE-COMMAND
-$cfg->setConfigEntry('default_console_command', 'tests');
+$cfg->setConfigEntry('default_console_command', 'main');
 
 // CFG: DEFAULT-TESTS-CONSOLE-COMMAND
-$cfg->setConfigEntry('default_tests_console_command', 'tests');
+$cfg->setConfigEntry('default_tests_console_command', 'main');
+
+// CFG: DEFAULT-TESTS-CONSOLE-CONTROLLER
+$cfg->setConfigEntry('default_tests_console_controller', 'main');
index 2bcca95a7273d75fa7e2cc15c1059b44bc5222de..c9b9e5d13632ecb47ab31f4affc5cd5b056d8b52 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Controller\Default;
 
 // Import framework stuff
 use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
 use CoreFramework\Factory\ObjectFactory;
 use CoreFramework\Request\Requestable;
 use CoreFramework\Response\Responseable;
index dcdfa84048d510ba4c2bf2e3b3aa8e09d95e12a9..d5477f666c364968e15b035406cd90ae3a0ce438 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Controller\Confirm;
 
 // Import framework stuff
 use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
 use CoreFramework\Factory\ObjectFactory;
 use CoreFramework\Response\Responseable;
 
index 5fbf4e352cd0fd1152573a6947b7a63bedb6db30..6a108016d2908a9356cd048875a6762e122764c0 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Controller\Default;
 
 // Import framework stuff
 use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
 use CoreFramework\Request\Requestable;
 use CoreFramework\Response\Responseable;
 
index 8a793bb1c3cca9b782d8328fd9c917d51bb72fed..e659be7ed8a9573e900f84fc2dc462f778b2783e 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Controller\News;
 
 // Import framework stuff
 use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
 use CoreFramework\Factory\ObjectFactory;
 use CoreFramework\Response\Responseable;
 
index ddcfb2e91311d130a9b2f10019ba1b4919e282f3..f6f9581b75721010d82c7b5e7a34f9ddbc896d92 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Controller\Login;
 
 // Import framework stuff
 use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
 use CoreFramework\Request\Requestable;
 use CoreFramework\Response\Responseable;
 
index a32264a517b9a27bceaaddaf1231a9bb47fd9a5e..9d7b940ea4224b6288d68d678e3739f4162984f3 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Controller\Failed;
 
 // Import framework stuff
 use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
 use CoreFramework\Request\Requestable;
 use CoreFramework\Response\Responseable;
 
index 8d96fb5d9416131634e10e24190bf2d0d655d5e6..465059670e235302c768c8a18df2119d2d42b1d0 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Controller\Logout;
 
 // Import framework stuff
 use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
 use CoreFramework\Factory\ObjectFactory;
 use CoreFramework\Request\Requestable;
 use CoreFramework\Response\Responseable;
index 4a2fa09a5f762e20c9c3676512639294d176d3b3..28460c471d2f16e1db84fde306d6a5a540efb763 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Controller\Logout;
 
 // Import framework stuff
 use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
 use CoreFramework\Request\Requestable;
 
 /**
index de8bbf371f237e0bcd0d352729fa3c1862cf9d8d..3cb8143595068497942b17b91d63fac4caf1d6d2 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Controller\Problem;
 
 // Import framework stuff
 use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
 use CoreFramework\Request\Requestable;
 use CoreFramework\Response\Responseable;
 
index e6214f61d5bc41027b487ffd7538b3c2f78d64ef..5357cedbfb089ca24d2fc5ddc8d406b30e4d704d 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Controller\Register;
 
 // Import framework stuff
 use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
 use CoreFramework\Response\Responseable;
 
 /**
index 59e13bd07d6effd853b4512361c5ab0c18ff6106..83dbe6452b9191f9ca21a8484874ba664b7dd408 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Controller\Status;
 
 // Import framework stuff
 use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
 use CoreFramework\Request\Requestable;
 use CoreFramework\Response\Responseable;
 
index d71343b5691195581de9a99be103be081f89a648..379300c5b7ac7a28436fbd52c909bc9390bd098c 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Controller\Form;
 
 // Import framework stuff
 use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
 use CoreFramework\Request\Requestable;
 use CoreFramework\Response\Responseable;
 
index 7b4c5d82264b71e69b630f672081eb9a5cd135d7..0b4608a0ff367ea501c63613d63b12d2cadf0cc8 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Controller\Login;
 
 // Import framework stuff
 use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
 use CoreFramework\Factory\ObjectFactory;
 use CoreFramework\Request\Requestable;
 use CoreFramework\Response\Responseable;
index a8144cee4f5458d1a87466df42933bca5a1c0b33..165dfd76e1be0faefdaeb32be5c20cd5cf5414d4 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Controller\Image\Captcha;
 
 // Import framework stuff
 use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
 use CoreFramework\Factory\ObjectFactory;
 use CoreFramework\Request\Requestable;
 use CoreFramework\Response\Responseable;
index 37424f9df3c126740ea7751b1a15f5d425238176..c1e22b8c1b2fe187efc9b4c9694bd9439dcee924 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Controller\Default;
 
 // Import framework stuff
 use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
 use CoreFramework\Request\Requestable;
 use CoreFramework\Response\Responseable;
 
index 395cc86387ed4ce9abada70a7d6136d1a750458d..ddbf41dd7993c64fc4d3a511fe676663105c6641 100644 (file)
@@ -29,6 +29,11 @@ use CoreFramework\Object\BaseFrameworkSystem;
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 class BaseResolver extends BaseFrameworkSystem {
+       /**
+        * Namespace
+        */
+       private $namespace = '';
+
        /**
         * Class name
         */
@@ -61,6 +66,25 @@ class BaseResolver extends BaseFrameworkSystem {
                parent::__construct($className);
        }
 
+       /**
+        * Getter for namespace
+        *
+        * @return      $namespace      Namespace to look in
+        */
+       public final function getNamespace () {
+               return $this->namespace;
+       }
+
+       /**
+        * Setter for namespace
+        *
+        * @param       $namespace      Namespace to look in
+        * @return      void
+        */
+       protected final function setNamespace ($namespace) {
+               $this->namespace = (string) $namespace;
+       }
+
        /**
         * Getter for class name
         *
@@ -70,6 +94,16 @@ class BaseResolver extends BaseFrameworkSystem {
                return $this->className;
        }
 
+       /**
+        * Setter for class name
+        *
+        * @param       $className      Name of the class
+        * @return      void
+        */
+       protected final function setClassName ($className) {
+               $this->className = (string) $className;
+       }
+
        /**
         * "Getter" for class name (useable for an object factory)
         *
@@ -86,16 +120,6 @@ class BaseResolver extends BaseFrameworkSystem {
                return $className;
        }
 
-       /**
-        * Setter for class name
-        *
-        * @param       $className      Name of the class
-        * @return      void
-        */
-       protected final function setClassName ($className) {
-               $this->className = (string) $className;
-       }
-
        /**
         * Getter for class prefix
         *
index fdcf6af03bcf740daeb17592b90818e4a45cda28..3d3188978eb26655a78da3de0ba308774c666f88 100644 (file)
@@ -3,10 +3,11 @@
 namespace CoreFramework\Resolver\Controller;
 
 // Import framework stuff
+use CoreFramework\Controller\DefaultControllerException;
+use CoreFramework\Controller\Generic\Controller;
 use CoreFramework\Factory\ObjectFactory;
 use CoreFramework\Resolver\BaseResolver;
 use CoreFramework\Resolver\Controller\ControllerResolver;
-
 /**
  * A generic controller resolver class
  *
@@ -46,13 +47,12 @@ class BaseControllerResolver extends BaseResolver {
         * controller was not found one of the default controllers will be used
         * depending on whether news shall be displayed.
         *
-        * @param       $namespace                              Namespace to look in
         * @param       $controllerName                 A controller name we shall look for
         * @return      $controllerInstance             A loaded controller instance
         * @throws      InvalidControllerException      Thrown if even the requested
         *                                                                              controller class is missing (bad!)
         */
-       protected function loadController ($namespace, $controllerName) {
+       protected function loadController ($controllerName) {
                // Cache default controller
                $defaultController = $this->getConfigInstance()->getConfigEntry('default_' . strtolower($this->getClassPrefix()) . '_controller');
 
@@ -62,7 +62,7 @@ class BaseControllerResolver extends BaseResolver {
                // Create full class name
                $className = sprintf(
                        '%s\%sDefaultNewsController',
-                       $namespace,
+                       $this->getNamespace(),
                        $this->getCapitalizedClassPrefix()
                );
 
@@ -150,7 +150,7 @@ class BaseControllerResolver extends BaseResolver {
                );
 
                // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('className=%s', $className));
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('className=%s', $className));
 
                // Now, let us create the full name of the controller class
                $this->setClassName($className);
@@ -188,11 +188,10 @@ class BaseControllerResolver extends BaseResolver {
                $controllerInstance = NULL;
 
                // Get namespace and controller name
-               $namespace      = $this->getNamespace();
                $controllerName = $this->getControllerName();
 
                // Get the controller
-               $controllerInstance = $this->loadController($namspace, $controllerName);
+               $controllerInstance = $this->loadController($controllerName);
 
                // And validate it
                if ((!is_object($controllerInstance)) || (!$controllerInstance instanceof Controller)) {
index 0a2d52c437b2a2dfe9bebb1be5387d365d6c40fa..e5a894576265c7e7050d3464f5eb4bbbc255435f 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 // Own namespace
-namespace CoreFramework\Controller;
+namespace CoreFramework\Controller\Generic;
 
 // Import framework stuff
 use CoreFramework\Generic\FrameworkInterface;