private function fitController($description, $handler) { if (!$this->getRestURI($description)) { return FALSE; } $function = RouteLib::getFunction($this->uri); if (is_array($function)) { $params = $function[1]; $function = $function[0]; } else { $params = array(); } $controller = Loader::controller($handler); if (method_exists($controller, $this->method . $function)) { $fn = $this->method . $function; } elseif (method_exists($controller, $function)) { $fn = $function; } elseif (method_exists($controller, 'resolve')) { $fn = 'resolve'; $params = array($this); } else { $this->_pop(); return FALSE; } $this->end(call_user_func_array(array($controller, $fn), $params)); return TRUE; }