src/Router.php
protected function matchRoute(ServerRequestInterface $request): ?RouteInterface
    {
        foreach ($this->routes as $route) {
            // Matched route will return new route instance with matched parameters
            $matched = $route->match($request);

            if (!empty($matched)) {
                return $matched;
            }
        }

        if (!empty($this->default)) {
            return $this->default->match($request);
        }

        // unable to match any route
        return null;
    }
protected function matchRoute(ServerRequestInterface $request): ?RouteInterface
    {
        foreach ($this->routes as $route) {
            // Matched route will return new route instance with matched parameters
            $matched = $route->match($request);

            if (!empty($matched)) {
                return $matched;
            }
        }

        if (!empty($this->default)) {
            return $this->default->match($request);
        }

        // unable to match any route
        return null;
    }
protected function matchRoute ( ServerRequestInterface $ request ) : ? RouteInterface { foreach ( $ this -> routes as $ route ) { // Matched route will return new route instance with matched parameters $ matched = $ route -> match ( $ request ) ; if ( ! empty ( $ matched ) ) { return $ matched ; } } if ( ! empty ( $ this -> default ) ) { return $ this -> default -> match ( $ request ) ; } // unable to match any route return null ; }
Find route matched for given request.

@param ServerRequestInterface $request

@return null|RouteInterface
Find route matched for given request .