Esempio n. 1
0
 public static function route(IServer $server)
 {
     $ctrlStr = $server->getCtrl();
     $view = [];
     //        \Controller\MainController()
     $controller = Factory::getInstance($ctrlStr);
     if ($controller instanceof \RFramework\Controller\IController) {
         $controller->setServer($server);
         if ($controller->_before()) {
             method_exists($controller, $server->getMethod()) && ($view = call_user_func([$controller, $server->getMethod()], $server->getParams()));
         }
         $controller->_after();
         //            method_exists($controller, '_before'), $
         //            $ctrl =
         //            if (method_exists())
     } else {
         die('controll is not exists');
     }
     $server->display($view);
 }
Esempio n. 2
0
 function setServer(IServer $server)
 {
     $this->_server = $server;
     $this->_params = $server->getParams();
 }