From 16d86ad95e6a5afec211ae4472667dd847b022d1 Mon Sep 17 00:00:00 2001 From: Stephan Kasdorf Date: Tue, 1 Aug 2017 12:01:16 +0200 Subject: [PATCH] Refactoring to maintain the framework standard. --- core/c/controller.php | 9 +++++++-- core/i/controller.php | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/core/c/controller.php b/core/c/controller.php index 150f9e5..bdb6700 100644 --- a/core/c/controller.php +++ b/core/c/controller.php @@ -22,6 +22,7 @@ class Controller protected function __construct() { + $this->_setController(); $this->_setConfig(Config::getInstance()->getConfig()); } @@ -62,9 +63,13 @@ class 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(); + } } /** diff --git a/core/i/controller.php b/core/i/controller.php index 5b5ef8f..0db3b1a 100644 --- a/core/i/controller.php +++ b/core/i/controller.php @@ -10,7 +10,12 @@ namespace Nibiru; */ interface IController { + /** + * @desc start name for the current Controller + * request search value for the Controller + */ const START_CONTROLLER_NAME = "index"; + const CONTROLLER_REQUEST_NAME = "controller"; /** * This should be part of any extended controller