public function find(Request $request, array $routes)
    {
        foreach ($routes as $route) {

            if(!$this->matchMethod($request, $route)){
                continue;
            }

            if(!$this->matchContentType($request, $route)){
                continue;
            }

            if(!$this->matchFilters($route)){
                continue;
            }

            $routeMatches = $this->matchPattern($request, $route);
            if ($routeMatches) {
                $route->setMatches($routeMatches);
                return $route;
            }
        }
        throw new RouteException(
            sprintf('No route found for uri "%s"', $request->getRequestUri()),
            $request,
            $routes
        );
    }
public function find(Request $request, array $routes)
    {
        foreach ($routes as $route) {

            if(!$this->matchMethod($request, $route)){
                continue;
            }

            if(!$this->matchContentType($request, $route)){
                continue;
            }

            if(!$this->matchFilters($route)){
                continue;
            }

            $routeMatches = $this->matchPattern($request, $route);
            if ($routeMatches) {
                $route->setMatches($routeMatches);
                return $route;
            }
        }
        throw new RouteException(
            sprintf('No route found for uri "%s"', $request->getRequestUri()),
            $request,
            $routes
        );
    }
public function find ( Request $ request , array $ routes ) { foreach ( $ routes as $ route ) { if ( ! $ this -> matchMethod ( $ request , $ route ) ) { continue ; } if ( ! $ this -> matchContentType ( $ request , $ route ) ) { continue ; } if ( ! $ this -> matchFilters ( $ route ) ) { continue ; } $ routeMatches = $ this -> matchPattern ( $ request , $ route ) ; if ( $ routeMatches ) { $ route -> setMatches ( $ routeMatches ) ; return $ route ; } } throw new RouteException ( sprintf ( 'No route found for uri "%s"' , $ request -> getRequestUri ( ) ) , $ request , $ routes ) ; }
Finds a route in matching its pattern with a uri.

@param Request $request
@param Route[] $routes
@return Route
Finds a route in matching its pattern with a uri .