src/Router.php
/**
     * Routes the requested uri to the appropriate route.
     * @param string $method The request method or empty string for any
     * @param string $uri The requested uri to route
     * @return null|Route The requested route or null if not found
     */
Routes the requested uri to the appropriate route.
@param string $method The request method or empty string for any
@param string $uri The requested uri to route
@return null|Route The requested route or null if not found
Routes the requested uri to the appropriate route . @param string $method The request method or empty string for any @param string $uri The requested uri to route @return null|Route The requested route or null if not found
public function route($method, $uri)
    {
        $routes = $this->provider->getRoutes();
        $urlPath = rawurldecode(parse_url((string) $uri, PHP_URL_PATH));
        $segments = array_filter(explode('/', $urlPath), 'strlen');
        $path = '/';
        do {
            if (isset($routes[$path])) {
                $route = $this->matchRoutes($routes[$path], $method, $segments);
                if ($route) {
                    return $route;
                }
            }
            $path .= array_shift($segments) . '/';
        } while ($segments);
        return null;
    }
public function route ( $ method , $ uri ) { $ routes = $ this -> provider -> getRoutes ( ) ; $ urlPath = rawurldecode ( parse_url ( ( string ) $ uri , PHP_URL_PATH ) ) ; $ segments = array_filter ( explode ( '/' , $ urlPath ) , 'strlen' ) ; $ path = '/' ; do { if ( isset ( $ routes [ $ path ] ) ) { $ route = $ this -> matchRoutes ( $ routes [ $ path ] , $ method , $ segments ) ; if ( $ route ) { return $ route ; } } $ path .= array_shift ( $ segments ) . '/' ; } while ( $ segments ) ; return null ; }
Routes the requested uri to the appropriate route.
Routes the requested uri to the appropriate route .