src/Matcher.php
protected function matchDynamicRoute($httpMethod, $path)
    {
        if ($routes = $this->collector->findDynamicRoutes($httpMethod, $path)) {
            // cache the parser reference
            $this->parser = $this->collector->getParser();
            // chunk routes for smaller regex groups using the Sturges' Formula
            foreach (array_chunk($routes, round(1 + 3.3 * log(count($routes))), true) as $chunk) {
                array_map([$this, "buildRoute"], $chunk);
                list($pattern, $map) = $this->buildGroup($chunk);

                if (!preg_match($pattern, $path, $matches)) {
                    continue;
                }

                /** @var Route $route */
                $route = $map[count($matches)];
                unset($matches[0]);

                $route->setParams(array_combine($route->getParams(), array_filter($matches)));

                return $route;
            }
        }

        return false;
    }
protected function matchDynamicRoute($httpMethod, $path)
    {
        if ($routes = $this->collector->findDynamicRoutes($httpMethod, $path)) {
            // cache the parser reference
            $this->parser = $this->collector->getParser();
            // chunk routes for smaller regex groups using the Sturges' Formula
            foreach (array_chunk($routes, round(1 + 3.3 * log(count($routes))), true) as $chunk) {
                array_map([$this, "buildRoute"], $chunk);
                list($pattern, $map) = $this->buildGroup($chunk);

                if (!preg_match($pattern, $path, $matches)) {
                    continue;
                }

                /** @var Route $route */
                $route = $map[count($matches)];
                unset($matches[0]);

                $route->setParams(array_combine($route->getParams(), array_filter($matches)));

                return $route;
            }
        }

        return false;
    }
protected function matchDynamicRoute ( $ httpMethod , $ path ) { if ( $ routes = $ this -> collector -> findDynamicRoutes ( $ httpMethod , $ path ) ) { // cache the parser reference $ this -> parser = $ this -> collector -> getParser ( ) ; // chunk routes for smaller regex groups using the Sturges' Formula foreach ( array_chunk ( $ routes , round ( 1 + 3.3 * log ( count ( $ routes ) ) ) , true ) as $ chunk ) { array_map ( [ $ this , "buildRoute" ] , $ chunk ) ; list ( $ pattern , $ map ) = $ this -> buildGroup ( $ chunk ) ; if ( ! preg_match ( $ pattern , $ path , $ matches ) ) { continue ; } /** @var Route $route */ $ route = $ map [ count ( $ matches ) ] ; unset ( $ matches [ 0 ] ) ; $ route -> setParams ( array_combine ( $ route -> getParams ( ) , array_filter ( $ matches ) ) ) ; return $ route ; } } return false ; }
Find and return the request dynamic route based on the compiled data and Path.

@param string $httpMethod
@param string $path

@return Route|false If the request match an array with the action and parameters will
be returned otherwise a false will.
Find and return the request dynamic route based on the compiled data and Path .