public static function run() { // get path info $path = $_SERVER['REQUEST_URI']; // let's see if the path exists in one or the request types // detect request type, TODO ;) $type = isset($_SERVER['REQUEST_METHOD']) ? strtolower($_SERVER['REQUEST_METHOD']) : 'get'; // default to get if server doesn't contain request method... $routes =& self::${$type}; if (!isset($routes[$path])) { // hmmm, welp, 404 I guess self::halt(404); } // set params if ($type !== 'get') { switch ($type) { case 'post': M::$params = $_POST; break; default: parse_str(file_get_contents("php://input"), M::$params); break; } } call_user_func($routes[$path]); exit; return; }