public function resolve(Request $request): ?Route
    {
        foreach( $this->indexes[$request->getMethod()] ?? [] as $route ){

            if( $route->matchUri($request->getPathInfo()) &&
                $route->matchMethod($request->getMethod()) &&
                $route->matchHostname($request->getHost()) &&
                $route->matchScheme($request->getScheme()) ){

                return $route;
            }
        }

        return null;
    }
public function resolve(Request $request): ?Route
    {
        foreach( $this->indexes[$request->getMethod()] ?? [] as $route ){

            if( $route->matchUri($request->getPathInfo()) &&
                $route->matchMethod($request->getMethod()) &&
                $route->matchHostname($request->getHost()) &&
                $route->matchScheme($request->getScheme()) ){

                return $route;
            }
        }

        return null;
    }
public function resolve ( Request $ request ) : ? Route { foreach ( $ this -> indexes [ $ request -> getMethod ( ) ] ?? [ ] as $ route ) { if ( $ route -> matchUri ( $ request -> getPathInfo ( ) ) && $ route -> matchMethod ( $ request -> getMethod ( ) ) && $ route -> matchHostname ( $ request -> getHost ( ) ) && $ route -> matchScheme ( $ request -> getScheme ( ) ) ) { return $ route ; } } return null ; }
Resolve a request into its route.

@param Request $request
@return Route|null
Resolve a request into its route .