diff --git a/public/index.php b/public/index.php index e81191a0..0f477cc7 100644 --- a/public/index.php +++ b/public/index.php @@ -145,9 +145,7 @@ $response = System\Routing\Filter::call('before', array(), true); // ---------------------------------------------------------- if (is_null($response)) { - list($method, $uri) = array(System\Request::method(), System\Request::uri()); - - $route = System\Routing\Router::make($method, $uri, System\Routing\Loader::load($uri))->route(); + $route = System\Routing\Router::make(Request::method(), Request::uri())->route(); $response = (is_null($route)) ? System\Response::make(System\View::make('error/404'), 404) : $route->call(); } diff --git a/system/routing/router.php b/system/routing/router.php index 29f83d93..bfabc18d 100644 --- a/system/routing/router.php +++ b/system/routing/router.php @@ -26,12 +26,13 @@ class Router { * @param array $routes * @return void */ - public function __construct($method, $uri, $routes) + public function __construct($method, $uri, $routes = null) { // Put the request method and URI in route form. Routes begin with // the request method and a forward slash. $this->request = $method.' /'.trim($uri, '/'); - $this->routes = $routes; + + $this->routes = (is_null($routes)) ? Loader::load($uri) : $routes; } /**