Esempio n. 1
0
 /**
  * Initializing router
  *
  * @return mixed
  */
 public function init()
 {
     $controller = String::upperFirst(strtolower(Request::get('controller')));
     $action = String::lower(Request::get('action')) . 'Action';
     $controllerData = ClassHandler::loadController($controller, $action);
     $controller = new $controllerData['controller']();
     if (method_exists($controller, 'init')) {
         call_user_func(array($controller, 'init'));
     }
     return call_user_func(array($controller, $controllerData['action']));
 }
Esempio n. 2
0
 /**
  *
  */
 public function testLoadController()
 {
     $classData = ClassHandler::loadController('', '');
     $this->assertEquals(['controller' => 'Codersquad\\Pestophp\\Mvc\\Controller', 'action' => 'defaultAction'], $classData);
 }