_setController(); $this->_setConfig(Config::getInstance()->getConfig()); } public static function getInstance() { $className = get_called_class(); if( self::$_instance == null ) { self::$_instance = new $className(); } return self::$_instance; } /** * @return array */ protected function getConfig() { return $this->_config; } /** * @param array $config */ protected function _setConfig( $config ) { $this->_config = $config; } /** * @return string */ public function getController() { return $this->_controller; } /** * @param string $controller */ private function _setController( ) { if(array_key_exists( IController::CONTROLLER_REQUEST_NAME, $this->getRequest()) ) { $this->_setNext( $this->getRequest()[IController::CONTROLLER_REQUEST_NAME] ); $this->_controller = $this->getNext(); } } /** * @param $template * @param $page */ public function action( $template, $page ) { $this->_setCurrent( $this->getNext() ); $this->_setNext( $page ); $template->display( $this->getNext() ); } public function varname( $template, $varname = array() ) { if(is_array($varname)) { $template->assign($varname); } } /** * @return array */ protected function getCurrent() { return $this->_current; } /** * @param array $current */ private function _setCurrent( $current ) { $this->_current = $current; } /** * @return array */ protected function getNext() { return $this->_next; } /** * @param array $next */ public function _setNext( $next ) { $this->_next = $next; } /** * @return array */ public function getPost() { return $_POST; } /** * @return array */ public function getGet() { return $_GET; } /** * @return array */ public function getRequest() { return $_REQUEST; } }