Example #1
0
 public function getResponse()
 {
     // Get Request Params
     $params = array();
     if (count($_GET) > 0) {
         $urlParams = explode('/', $_GET["url"]);
         if (count($urlParams) > 0) {
             $controller = array_shift($urlParams);
             $action = array_shift($urlParams);
             $params = $urlParams;
         }
     } else {
         $controller = $this->config->getDefaultController();
         $action = $this->config->getDefaultAction();
     }
     // Set Controller
     $controller = ucfirst($controller) . '_Controller';
     $action = strtolower($action) . 'Action';
     $this->controller = $this->_getController($controller);
     // Check if controlller as action
     if (method_exists($controller, $action)) {
         // Call action method in controller
         call_user_func_array(array($this->controller, $action), $params);
     } else {
         throw new Exception("Action:" . $action . " cannot be found.", 4);
     }
 }