public function route($method, $uri)
    {
        // Remove subfolder from URI if needed
        $baseDir = $this->get('___.baseDir');
        if ("/" !== $baseDir && 0 === strpos($uri, $baseDir)) {
            $uri = substr($uri, strlen($baseDir));
        }

        // Check which route is being used.
        $routings = $this->routings;
        $this->dispatcher = $this->dispatcher ?: \FastRoute\simpleDispatcher(function(\FastRoute\RouteCollector $r) use ($routings) {
            foreach ($routings as $name => $routing) {
                // 'GET', '/user/{id:\d+}', $routeName
                $r->addRoute($routing[0], $routing[1], $name);
            }
        });

        $routeInfo = $this->dispatcher->dispatch($method, $uri);

        if (\FastRoute\Dispatcher::FOUND === $routeInfo[0]) {
            return array_slice($routeInfo, 1);
        }

        return null;
    }
public function route($method, $uri)
    {
        // Remove subfolder from URI if needed
        $baseDir = $this->get('___.baseDir');
        if ("/" !== $baseDir && 0 === strpos($uri, $baseDir)) {
            $uri = substr($uri, strlen($baseDir));
        }

        // Check which route is being used.
        $routings = $this->routings;
        $this->dispatcher = $this->dispatcher ?: \FastRoute\simpleDispatcher(function(\FastRoute\RouteCollector $r) use ($routings) {
            foreach ($routings as $name => $routing) {
                // 'GET', '/user/{id:\d+}', $routeName
                $r->addRoute($routing[0], $routing[1], $name);
            }
        });

        $routeInfo = $this->dispatcher->dispatch($method, $uri);

        if (\FastRoute\Dispatcher::FOUND === $routeInfo[0]) {
            return array_slice($routeInfo, 1);
        }

        return null;
    }
public function route ( $ method , $ uri ) { // Remove subfolder from URI if needed $ baseDir = $ this -> get ( '___.baseDir' ) ; if ( "/" !== $ baseDir && 0 === strpos ( $ uri , $ baseDir ) ) { $ uri = substr ( $ uri , strlen ( $ baseDir ) ) ; } // Check which route is being used. $ routings = $ this -> routings ; $ this -> dispatcher = $ this -> dispatcher ? : \ FastRoute \ simpleDispatcher ( function ( \ FastRoute \ RouteCollector $ r ) use ( $ routings ) { foreach ( $ routings as $ name => $ routing ) { // 'GET', '/user/{id:\d+}', $routeName $ r -> addRoute ( $ routing [ 0 ] , $ routing [ 1 ] , $ name ) ; } } ) ; $ routeInfo = $ this -> dispatcher -> dispatch ( $ method , $ uri ) ; if ( \ FastRoute \ Dispatcher :: FOUND === $ routeInfo [ 0 ] ) { return array_slice ( $ routeInfo , 1 ) ; } return null ; }
Determin which route to use and parameters in uri.

@param string $method HTTP Method used
@param string $uri request path, without query string
@return array|null [$routeName, $params]
Determin which route to use and parameters in uri .