public function dispatch() { $controller = self::getController() . 'Controller'; $route = ROOT . DS . 'application' . DS . 'controller' . DS . $controller . '.php'; $action = self::getAction(); $params = self::getParams(); if (is_readable($route)) { $controller = new $controller(self::getController(), $action, $params); if (!is_callable(array($controller, $action))) { $this->action = 'index'; } if (isset($params)) { call_user_func_array(array($controller, self::getAction()), self::getParams()); } else { call_user_func(array($controller, self::getAction())); } } else { $controller = new errorController('error', 'error404', array()); $controller->error404(); } }