// 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
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);
}
// 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
$controllerName = '';
$controllerInstance = NULL;
- // Get the command name
+ // Get namespace and command name
$controllerName = $this->getControllerName();
// Get the command
$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');
// Import framework stuff
use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
use CoreFramework\Factory\ObjectFactory;
use CoreFramework\Request\Requestable;
use CoreFramework\Response\Responseable;
// Import framework stuff
use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
use CoreFramework\Factory\ObjectFactory;
use CoreFramework\Response\Responseable;
// Import framework stuff
use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
use CoreFramework\Request\Requestable;
use CoreFramework\Response\Responseable;
// Import framework stuff
use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
use CoreFramework\Factory\ObjectFactory;
use CoreFramework\Response\Responseable;
// Import framework stuff
use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
use CoreFramework\Request\Requestable;
use CoreFramework\Response\Responseable;
// Import framework stuff
use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
use CoreFramework\Request\Requestable;
use CoreFramework\Response\Responseable;
// Import framework stuff
use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
use CoreFramework\Factory\ObjectFactory;
use CoreFramework\Request\Requestable;
use CoreFramework\Response\Responseable;
// Import framework stuff
use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
use CoreFramework\Request\Requestable;
/**
// Import framework stuff
use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
use CoreFramework\Request\Requestable;
use CoreFramework\Response\Responseable;
// Import framework stuff
use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
use CoreFramework\Response\Responseable;
/**
// Import framework stuff
use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
use CoreFramework\Request\Requestable;
use CoreFramework\Response\Responseable;
// Import framework stuff
use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
use CoreFramework\Request\Requestable;
use CoreFramework\Response\Responseable;
// Import framework stuff
use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
use CoreFramework\Factory\ObjectFactory;
use CoreFramework\Request\Requestable;
use CoreFramework\Response\Responseable;
// Import framework stuff
use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
use CoreFramework\Factory\ObjectFactory;
use CoreFramework\Request\Requestable;
use CoreFramework\Response\Responseable;
// Import framework stuff
use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Generic\Controller;
use CoreFramework\Request\Requestable;
use CoreFramework\Response\Responseable;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class BaseResolver extends BaseFrameworkSystem {
+ /**
+ * Namespace
+ */
+ private $namespace = '';
+
/**
* Class name
*/
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
*
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)
*
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
*
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
*
* 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');
// Create full class name
$className = sprintf(
'%s\%sDefaultNewsController',
- $namespace,
+ $this->getNamespace(),
$this->getCapitalizedClassPrefix()
);
);
// 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);
$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)) {
<?php
// Own namespace
-namespace CoreFramework\Controller;
+namespace CoreFramework\Controller\Generic;
// Import framework stuff
use CoreFramework\Generic\FrameworkInterface;