Refactoring to maintain the framework standard.

This commit is contained in:
Stephan Kasdorf
2017-08-01 12:01:16 +02:00
parent 8a4dddd7d5
commit 16d86ad95e
2 changed files with 12 additions and 2 deletions

View File

@@ -22,6 +22,7 @@ class Controller
protected function __construct() protected function __construct()
{ {
$this->_setController();
$this->_setConfig(Config::getInstance()->getConfig()); $this->_setConfig(Config::getInstance()->getConfig());
} }
@@ -62,9 +63,13 @@ class Controller
/** /**
* @param string $controller * @param string $controller
*/ */
protected function setController( $controller ) private function _setController( )
{ {
$this->_controller = $controller; if(array_key_exists( IController::CONTROLLER_REQUEST_NAME, $this->getRequest()) )
{
$this->_setNext( $this->getRequest()[IController::CONTROLLER_REQUEST_NAME] );
$this->_controller = $this->getNext();
}
} }
/** /**

View File

@@ -10,7 +10,12 @@ namespace Nibiru;
*/ */
interface IController interface IController
{ {
/**
* @desc start name for the current Controller
* request search value for the Controller
*/
const START_CONTROLLER_NAME = "index"; const START_CONTROLLER_NAME = "index";
const CONTROLLER_REQUEST_NAME = "controller";
/** /**
* This should be part of any extended controller * This should be part of any extended controller