$config) { if ($config['auto']) Bundle::start($bundle); } /** * Route the request to the proper route in the application. If a * route is found, the route will be called via the request class * static property. If no route is found, the 404 response will * be returned to the browser. */ if (count(URI::$segments) > 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();