15) { throw new \Exception("Invalid request. Too many URI segments."); } Request::$route = Routing\Router::route(Request::method(), URI::current()); if ( ! is_null(Request::$route)) { $response = Request::$route->call(); } else { $response = Response::error('404'); } /** * Close the session and write the active payload to persistent * storage. The session cookie will also be written and if the * driver is a sweeper, session garbage collection might be * performed depending on the "sweepage" probability. */ if (Config::get('session.driver') !== '') { Session::save(); } $response->send();