src/Services/Router.php
private function find(Contracts\Request $request)
    {
        $method = $request->method();
        $path   = $request->path();
        foreach ($this->routes as $route) {
            if ($route->method == $method) {
                $pattern = $this->pattern($route);
                if (preg_match($pattern, $path)) {
                    return $route;
                }
            }
        }

        return null;
    }
private function find(Contracts\Request $request)
    {
        $method = $request->method();
        $path   = $request->path();
        foreach ($this->routes as $route) {
            if ($route->method == $method) {
                $pattern = $this->pattern($route);
                if (preg_match($pattern, $path)) {
                    return $route;
                }
            }
        }

        return null;
    }
private function find ( Contracts \ Request $ request ) { $ method = $ request -> method ( ) ; $ path = $ request -> path ( ) ; foreach ( $ this -> routes as $ route ) { if ( $ route -> method == $ method ) { $ pattern = $ this -> pattern ( $ route ) ; if ( preg_match ( $ pattern , $ path ) ) { return $ route ; } } } return null ; }
Find the route matching the given request.

@param Contracts\Request $request
@return object|null
Find the route matching the given request .