private function route(Request $request) : RouteMatch
    {
        foreach ($this->routes as $route) {
            try {
                $match = $route->match($request);
            }
            catch (RoutingException $e) {
                throw new HttpNotFoundException($e->getMessage(), $e);
            }

            if ($match !== null) {
                if ($match instanceof RouteMatch) {
                    return $match;
                }

                throw $this->invalidReturnValue('route', Route::class . ' or NULL', $match);
            }
        }

        throw new HttpNotFoundException('No route matches the request.');
    }
private function route(Request $request) : RouteMatch
    {
        foreach ($this->routes as $route) {
            try {
                $match = $route->match($request);
            }
            catch (RoutingException $e) {
                throw new HttpNotFoundException($e->getMessage(), $e);
            }

            if ($match !== null) {
                if ($match instanceof RouteMatch) {
                    return $match;
                }

                throw $this->invalidReturnValue('route', Route::class . ' or NULL', $match);
            }
        }

        throw new HttpNotFoundException('No route matches the request.');
    }
private function route ( Request $ request ) : RouteMatch { foreach ( $ this -> routes as $ route ) { try { $ match = $ route -> match ( $ request ) ; } catch ( RoutingException $ e ) { throw new HttpNotFoundException ( $ e -> getMessage ( ) , $ e ) ; } if ( $ match !== null ) { if ( $ match instanceof RouteMatch ) { return $ match ; } throw $ this -> invalidReturnValue ( 'route' , Route :: class . ' or NULL' , $ match ) ; } } throw new HttpNotFoundException ( 'No route matches the request.' ) ; }
Routes the given Request.

@param Request $request The request.

@return RouteMatch The route match.

@throws HttpNotFoundException     If no route matches the request.
@throws \UnexpectedValueException If a route returns an invalid value.
Routes the given Request .