From: Roland Haeder Date: Fri, 24 Feb 2017 20:48:55 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=015c9d406c90225160488fcaaebe4575ce5cf61a;p=core.git Continued: - added missing controller for "tests" application (with own namespace) - added "import" for BaseController Signed-off-by: Roland Häder --- diff --git a/application/tests/classes/controller/.htaccess b/application/tests/classes/controller/.htaccess new file mode 100644 index 00000000..3a428827 --- /dev/null +++ b/application/tests/classes/controller/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/tests/classes/controller/console/.htaccess b/application/tests/classes/controller/console/.htaccess new file mode 100644 index 00000000..3a428827 --- /dev/null +++ b/application/tests/classes/controller/console/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/tests/classes/controller/console/class_TestsConsoleDefaultNewsController.php b/application/tests/classes/controller/console/class_TestsConsoleDefaultNewsController.php new file mode 100644 index 00000000..2f6e4153 --- /dev/null +++ b/application/tests/classes/controller/console/class_TestsConsoleDefaultNewsController.php @@ -0,0 +1,143 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class TestsConsoleDefaultNewsController extends BaseController implements Controller { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Init additional filter chains + /* + foreach (array('bootstrap', 'activation','shutdown') as $filterChain) { + $this->initFilterChain($filterChain); + } // END - foreach + */ + } + + /** + * Creates an instance of this class + * + * @param $resolverInstance An instance of a command resolver class + * @return $controllerInstance A prepared instance of this class + */ + public static final function createTestsConsoleDefaultNewsController (CommandResolver $resolverInstance) { + // Create the instance + $controllerInstance = new TestsConsoleDefaultNewsController(); + + // Set the command resolver + $controllerInstance->setResolverInstance($resolverInstance); + + // Add news filters to this controller + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter')); + + // Return the prepared instance + return $controllerInstance; + } + + /** + * Handles the given request and response + * + * @param $requestInstance An instance of a request class + * @param $responseInstance An instance of a response class + * @return void + */ + public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) { + // Get the command instance from the resolver by sending a request instance to the resolver + $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance); + + // Add more filters by the command + $commandInstance->addExtraFilters($this, $requestInstance); + + // Run the pre filters + $this->executePreFilters($requestInstance, $responseInstance); + + // This request was valid! :-D + $requestInstance->requestIsValid(); + + // Execute the command + $commandInstance->execute($requestInstance, $responseInstance); + + // Run the pre filters + $this->executePostFilters($requestInstance, $responseInstance); + + // Flush the response out + $responseInstance->flushBuffer(); + } + + /** + * Add a bootstrap filter + * + * @param $filterInstance A Filterable class + * @return void + */ + public function addBootstrapFilter (Filterable $filterInstance) { + $this->addFilter('bootstrap', $filterInstance); + } + + /** + * Executes all bootstrap filters + * + * @param $requestInstance A Requestable class + * @param $responseInstance A Responseable class + * @return void + */ + public function executeBootstrapFilters (Requestable $requestInstance, Responseable $responseInstance) { + $this->executeFilters('bootstrap', $requestInstance, $responseInstance); + } + + /** + * Add a hub activation filter + * + * @param $filterInstance A Filterable class + * @return void + */ + public function addActivationFilter (Filterable $filterInstance) { + $this->addFilter('activation', $filterInstance); + } + + /** + * Executes all hub activation filters + * + * @param $requestInstance A Requestable class + * @param $responseInstance A Responseable class + * @return void + */ + public function executeActivationFilters (Requestable $requestInstance, Responseable $responseInstance) { + $this->executeFilters('activation', $requestInstance, $responseInstance); + } +} + +// [EOF] +?> diff --git a/application/tests/classes/resolver/controller/class_TestsConsoleControllerResolver.php b/application/tests/classes/resolver/controller/class_TestsConsoleControllerResolver.php index 4a76f17b..f5ed6a92 100644 --- a/application/tests/classes/resolver/controller/class_TestsConsoleControllerResolver.php +++ b/application/tests/classes/resolver/controller/class_TestsConsoleControllerResolver.php @@ -1,6 +1,10 @@ isControllerValid($controllerName) === FALSE) { + } elseif ($resolverInstance->isControllerValid(__NAMESPACE__, $controllerName) === FALSE) { // Invalid command found throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER); } diff --git a/inc/main/classes/controller/console/class_ConsoleDefaultController.php b/inc/main/classes/controller/console/class_ConsoleDefaultController.php index 08f15058..cd4afa36 100644 --- a/inc/main/classes/controller/console/class_ConsoleDefaultController.php +++ b/inc/main/classes/controller/console/class_ConsoleDefaultController.php @@ -3,6 +3,7 @@ namespace CoreFramework\Controller\Default; // Import framework stuff +use CoreFramework\Controller\BaseController; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/controller/console/class_ConsoleDefaultNewsController.php b/inc/main/classes/controller/console/class_ConsoleDefaultNewsController.php index a049d1b2..2bcca95a 100644 --- a/inc/main/classes/controller/console/class_ConsoleDefaultNewsController.php +++ b/inc/main/classes/controller/console/class_ConsoleDefaultNewsController.php @@ -3,6 +3,7 @@ namespace CoreFramework\Controller\Default; // Import framework stuff +use CoreFramework\Controller\BaseController; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/controller/html/class_HtmlConfirmController.php b/inc/main/classes/controller/html/class_HtmlConfirmController.php index 4300853d..dcdfa840 100644 --- a/inc/main/classes/controller/html/class_HtmlConfirmController.php +++ b/inc/main/classes/controller/html/class_HtmlConfirmController.php @@ -3,6 +3,7 @@ namespace CoreFramework\Controller\Confirm; // Import framework stuff +use CoreFramework\Controller\BaseController; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/controller/html/class_HtmlDefaultController.php b/inc/main/classes/controller/html/class_HtmlDefaultController.php index fc958b88..5fbf4e35 100644 --- a/inc/main/classes/controller/html/class_HtmlDefaultController.php +++ b/inc/main/classes/controller/html/class_HtmlDefaultController.php @@ -3,6 +3,7 @@ namespace CoreFramework\Controller\Default; // Import framework stuff +use CoreFramework\Controller\BaseController; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/controller/html/class_HtmlDefaultNewsController.php b/inc/main/classes/controller/html/class_HtmlDefaultNewsController.php index 4f777407..8a793bb1 100644 --- a/inc/main/classes/controller/html/class_HtmlDefaultNewsController.php +++ b/inc/main/classes/controller/html/class_HtmlDefaultNewsController.php @@ -3,6 +3,7 @@ namespace CoreFramework\Controller\News; // Import framework stuff +use CoreFramework\Controller\BaseController; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/controller/html/class_HtmlLoginController.php b/inc/main/classes/controller/html/class_HtmlLoginController.php index 552c0b6b..ddcfb2e9 100644 --- a/inc/main/classes/controller/html/class_HtmlLoginController.php +++ b/inc/main/classes/controller/html/class_HtmlLoginController.php @@ -3,6 +3,7 @@ namespace CoreFramework\Controller\Login; // Import framework stuff +use CoreFramework\Controller\BaseController; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/controller/html/class_HtmlLoginFailedController.php b/inc/main/classes/controller/html/class_HtmlLoginFailedController.php index b1c1f7f3..a32264a5 100644 --- a/inc/main/classes/controller/html/class_HtmlLoginFailedController.php +++ b/inc/main/classes/controller/html/class_HtmlLoginFailedController.php @@ -3,6 +3,7 @@ namespace CoreFramework\Controller\Failed; // Import framework stuff +use CoreFramework\Controller\BaseController; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/controller/html/class_HtmlLogoutController.php b/inc/main/classes/controller/html/class_HtmlLogoutController.php index 8cd75c35..8d96fb5d 100644 --- a/inc/main/classes/controller/html/class_HtmlLogoutController.php +++ b/inc/main/classes/controller/html/class_HtmlLogoutController.php @@ -3,6 +3,7 @@ namespace CoreFramework\Controller\Logout; // Import framework stuff +use CoreFramework\Controller\BaseController; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/controller/html/class_HtmlLogoutDoneController.php b/inc/main/classes/controller/html/class_HtmlLogoutDoneController.php index 93ea1371..4a2fa09a 100644 --- a/inc/main/classes/controller/html/class_HtmlLogoutDoneController.php +++ b/inc/main/classes/controller/html/class_HtmlLogoutDoneController.php @@ -3,6 +3,7 @@ namespace CoreFramework\Controller\Logout; // Import framework stuff +use CoreFramework\Controller\BaseController; use CoreFramework\Request\Requestable; /** diff --git a/inc/main/classes/controller/html/class_HtmlProblemController.php b/inc/main/classes/controller/html/class_HtmlProblemController.php index 89134f35..de8bbf37 100644 --- a/inc/main/classes/controller/html/class_HtmlProblemController.php +++ b/inc/main/classes/controller/html/class_HtmlProblemController.php @@ -3,6 +3,7 @@ namespace CoreFramework\Controller\Problem; // Import framework stuff +use CoreFramework\Controller\BaseController; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/controller/html/class_HtmlRegisterController.php b/inc/main/classes/controller/html/class_HtmlRegisterController.php index 194ead9a..e6214f61 100644 --- a/inc/main/classes/controller/html/class_HtmlRegisterController.php +++ b/inc/main/classes/controller/html/class_HtmlRegisterController.php @@ -3,6 +3,7 @@ namespace CoreFramework\Controller\Register; // Import framework stuff +use CoreFramework\Controller\BaseController; use CoreFramework\Response\Responseable; /** diff --git a/inc/main/classes/controller/html/class_HtmlStatusController.php b/inc/main/classes/controller/html/class_HtmlStatusController.php index c5811bcf..59e13bd0 100644 --- a/inc/main/classes/controller/html/class_HtmlStatusController.php +++ b/inc/main/classes/controller/html/class_HtmlStatusController.php @@ -3,6 +3,7 @@ namespace CoreFramework\Controller\Status; // Import framework stuff +use CoreFramework\Controller\BaseController; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/controller/html/form/class_HtmlDoFormController.php b/inc/main/classes/controller/html/form/class_HtmlDoFormController.php index e667ec61..d71343b5 100644 --- a/inc/main/classes/controller/html/form/class_HtmlDoFormController.php +++ b/inc/main/classes/controller/html/form/class_HtmlDoFormController.php @@ -3,6 +3,7 @@ namespace CoreFramework\Controller\Form; // Import framework stuff +use CoreFramework\Controller\BaseController; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/controller/html/login/class_HtmlLoginAreaController.php b/inc/main/classes/controller/html/login/class_HtmlLoginAreaController.php index 7a03eb56..7b4c5d82 100644 --- a/inc/main/classes/controller/html/login/class_HtmlLoginAreaController.php +++ b/inc/main/classes/controller/html/login/class_HtmlLoginAreaController.php @@ -3,6 +3,7 @@ namespace CoreFramework\Controller\Login; // Import framework stuff +use CoreFramework\Controller\BaseController; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/controller/image/captcha/class_ImageCodeCaptchaController.php b/inc/main/classes/controller/image/captcha/class_ImageCodeCaptchaController.php index ddb0d441..a8144cee 100644 --- a/inc/main/classes/controller/image/captcha/class_ImageCodeCaptchaController.php +++ b/inc/main/classes/controller/image/captcha/class_ImageCodeCaptchaController.php @@ -3,6 +3,7 @@ namespace CoreFramework\Controller\Image\Captcha; // Import framework stuff +use CoreFramework\Controller\BaseController; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/controller/image/class_ImageDefaultController.php b/inc/main/classes/controller/image/class_ImageDefaultController.php index 882e480d..37424f9d 100644 --- a/inc/main/classes/controller/image/class_ImageDefaultController.php +++ b/inc/main/classes/controller/image/class_ImageDefaultController.php @@ -3,6 +3,7 @@ namespace CoreFramework\Controller\Default; // Import framework stuff +use CoreFramework\Controller\BaseController; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/output/debug/console/class_DebugConsoleOutput.php b/inc/main/classes/output/debug/console/class_DebugConsoleOutput.php index 8c0a749a..3b6dff70 100644 --- a/inc/main/classes/output/debug/console/class_DebugConsoleOutput.php +++ b/inc/main/classes/output/debug/console/class_DebugConsoleOutput.php @@ -66,10 +66,7 @@ class DebugConsoleOutput extends BaseDebugOutput implements Debugger, OutputStre if ($stripTags === TRUE) { // Prepare the output without HTML tags $output = trim(html_entity_decode(strip_tags(stripslashes($output)))); - } else { - // Prepare the output with HTML tags - $output = trim(stripslashes($output)); - } + } // END - if // Are debug times enabled? if ($this->getConfigInstance()->getConfigEntry('debug_' . self::getResponseTypeFromSystem() . '_output_timings') == 'Y') { diff --git a/inc/main/classes/resolver/controller/class_BaseControllerResolver.php b/inc/main/classes/resolver/controller/class_BaseControllerResolver.php index 13a086a8..8f4f0248 100644 --- a/inc/main/classes/resolver/controller/class_BaseControllerResolver.php +++ b/inc/main/classes/resolver/controller/class_BaseControllerResolver.php @@ -45,20 +45,28 @@ 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 ($controllerName) { + protected function loadController ($namespace, $controllerName) { // Cache default controller $defaultController = $this->getConfigInstance()->getConfigEntry('default_' . strtolower($this->getClassPrefix()) . '_controller'); // Init controller instance $controllerInstance = NULL; + // Create full class name + $className = sprintf( + '%s\%sDefaultNewsController', + $namespace, + $this->getCapitalizedClassPrefix() + ); + // Default controller - $this->setClassName($this->getCapitalizedClassPrefix() . 'DefaultNewsController'); + $this->setClassName($className); // Generate the class name //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BEFORE: controller=' . $controllerName); @@ -70,7 +78,7 @@ class BaseControllerResolver extends BaseResolver { $this->setClassName($className); } else { // No news at main controller or non-news controller - $this->setClassName($this->getCapitalizedClassPrefix() . 'DefaultNewsController'); + $this->setClassName($className); } //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('AFTER: controller=' . $this->getClassName()); @@ -109,23 +117,39 @@ class BaseControllerResolver extends BaseResolver { /** * Checks whether the given controller is valid * + * @param $namespace Namespace to look in, no trailing backslash * @param $controllerName The default controller we shall execute * @return $isValid Whether the given controller is valid * @throws EmptyVariableException Thrown if given controller is not set * @throws DefaultControllerException Thrown if default controller was not found */ - public function isControllerValid ($controllerName) { + public function isControllerValid ($namespace, $controllerName) { // By default nothing shall be valid $isValid = FALSE; - // Is a controller set? - if (empty($controllerName)) { + // Is namespace and controller name set? + if (empty($namespace)) { + // Then thrown an exception here + throw new EmptyVariableException(array($this, 'namespace'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); + } elseif (empty($controllerName)) { // Then thrown an exception here throw new EmptyVariableException(array($this, 'controllerName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); } // END - if // Create class name - $className = $this->getCapitalizedClassPrefix() . self::convertToClassName($controllerName) . 'Controller'; + $className = sprintf( + '%s\%sController', + $namespace, + $this->getCapitalizedClassPrefix() . self::convertToClassName($controllerName) + ); + $newsControllerName = sprintf( + '%s\%sDefaultNewsController', + $namespace, + $this->getCapitalizedClassPrefix() + ); + + // Debug message + /* 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); @@ -136,9 +160,9 @@ class BaseControllerResolver extends BaseResolver { if (class_exists($this->getClassName())) { // This class does exist. :-) $isValid = TRUE; - } elseif ($this->getClassName() != $this->getCapitalizedClassPrefix() . 'DefaultNewsController') { + } elseif ($this->getClassName() != $newsControllerName) { // Set default controller - $this->setClassName($this->getCapitalizedClassPrefix() . 'DefaultNewsController'); + $this->setClassName($newsControllerName); } else { // All is tried, give it up here throw new DefaultControllerException($this, self::EXCEPTION_DEFAULT_CONTROLLER_GONE); @@ -162,11 +186,12 @@ class BaseControllerResolver extends BaseResolver { $controllerName = ''; $controllerInstance = NULL; - // Get the controller name + // Get namespace and controller name + $namespace = $this->getNamespace(); $controllerName = $this->getControllerName(); // Get the controller - $controllerInstance = $this->loadController($controllerName); + $controllerInstance = $this->loadController($namspace, $controllerName); // And validate it if ((!is_object($controllerInstance)) || (!$controllerInstance instanceof Controller)) { diff --git a/inc/main/classes/resolver/controller/console/class_ConsoleControllerResolver.php b/inc/main/classes/resolver/controller/console/class_ConsoleControllerResolver.php index dd355433..096a4b15 100644 --- a/inc/main/classes/resolver/controller/console/class_ConsoleControllerResolver.php +++ b/inc/main/classes/resolver/controller/console/class_ConsoleControllerResolver.php @@ -3,6 +3,7 @@ namespace CoreFramework\Resolver\Controller; // Import framework stuff +use CoreFramework\Controller\BaseController; use CoreFramework\Manager\ManageableApplication; /** @@ -44,13 +45,14 @@ class ConsoleControllerResolver extends BaseControllerResolver implements Contro /** * Creates an instance of a resolver class with a given controller * + * @param $namespace Namespace to look in * @param $controllerName The controller we shall resolve * @param $applicationInstance An instance of a manageable application helper class * @return $resolverInstance The prepared controller resolver instance * @throws EmptyVariableException Thrown if default controller is not set * @throws InvalidControllerException Thrown if default controller is invalid */ - public static final function createConsoleControllerResolver ($controllerName, ManageableApplication $applicationInstance) { + public static final function createConsoleControllerResolver ($namespace, $controllerName, ManageableApplication $applicationInstance) { // Create the new instance $resolverInstance = new ConsoleControllerResolver(); @@ -58,7 +60,7 @@ class ConsoleControllerResolver extends BaseControllerResolver implements Contro if (empty($controllerName)) { // Then thrown an exception here throw new EmptyVariableException(array($resolverInstance, 'controllerName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif ($resolverInstance->isControllerValid($controllerName) === FALSE) { + } elseif ($resolverInstance->isControllerValid($namespace, $controllerName) === FALSE) { // Invalid controller found throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER); } diff --git a/inc/main/classes/resolver/controller/html/class_HtmlControllerResolver.php b/inc/main/classes/resolver/controller/html/class_HtmlControllerResolver.php index 8882dbdb..0890dff5 100644 --- a/inc/main/classes/resolver/controller/html/class_HtmlControllerResolver.php +++ b/inc/main/classes/resolver/controller/html/class_HtmlControllerResolver.php @@ -3,6 +3,7 @@ namespace CoreFramework\Resolver\Controller; // Import framework stuff +use CoreFramework\Controller\BaseController; use CoreFramework\Manager\ManageableApplication; /** @@ -44,13 +45,14 @@ class HtmlControllerResolver extends BaseControllerResolver implements Controlle /** * Creates an instance of a resolver class with a given controller * + * @param $namespace Namespace to look in * @param $controllerName The controller we shall resolve * @param $applicationInstance An instance of a manageable application helper class * @return $resolverInstance The prepared controller resolver instance * @throws EmptyVariableException Thrown if default controller is not set * @throws InvalidControllerException Thrown if default controller is invalid */ - public static final function createHtmlControllerResolver ($controllerName, ManageableApplication $applicationInstance) { + public static final function createHtmlControllerResolver ($namespace, $controllerName, ManageableApplication $applicationInstance) { // Create the new instance $resolverInstance = new HtmlControllerResolver(); @@ -58,7 +60,7 @@ class HtmlControllerResolver extends BaseControllerResolver implements Controlle if (empty($controllerName)) { // Then thrown an exception here throw new EmptyVariableException(array($resolverInstance, 'controllerName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif ($resolverInstance->isControllerValid($controllerName) === FALSE) { + } elseif ($resolverInstance->isControllerValid($namespace, $controllerName) === FALSE) { // Invalid controller found throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER); } diff --git a/inc/main/classes/resolver/controller/image/class_ImageControllerResolver.php b/inc/main/classes/resolver/controller/image/class_ImageControllerResolver.php index 7098713d..3863c0e9 100644 --- a/inc/main/classes/resolver/controller/image/class_ImageControllerResolver.php +++ b/inc/main/classes/resolver/controller/image/class_ImageControllerResolver.php @@ -3,6 +3,7 @@ namespace CoreFramework\Resolver\Controller; // Import framework stuff +use CoreFramework\Controller\BaseController; use CoreFramework\Manager\ManageableApplication; /** @@ -44,13 +45,14 @@ class ImageControllerResolver extends BaseControllerResolver implements Controll /** * Creates an instance of a resolver class with a given controller * + * @param $namespace Namespace to look in * @param $controllerName The controller we shall resolve * @param $applicationInstance An instance of a manageable application helper class * @return $resolverInstance The prepared controller resolver instance * @throws EmptyVariableException Thrown if default controller is not set * @throws InvalidControllerException Thrown if default controller is invalid */ - public static final function createImageControllerResolver ($controllerName, ManageableApplication $applicationInstance) { + public static final function createImageControllerResolver ($namespace, $controllerName, ManageableApplication $applicationInstance) { // Create the new instance $resolverInstance = new ImageControllerResolver(); @@ -58,7 +60,7 @@ class ImageControllerResolver extends BaseControllerResolver implements Controll if (empty($controllerName)) { // Then thrown an exception here throw new EmptyVariableException(array($resolverInstance, 'controllerName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif ($resolverInstance->isControllerValid($controllerName) === FALSE) { + } elseif ($resolverInstance->isControllerValid($namespace, $controllerName) === FALSE) { // Invalid controller found throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER); }