public function matchRoute(string $path, string $method = null): ? Route
    {
        // Validate the path
        $path   = $this->validatePath($path);
        $method = $method ?? RequestMethod::GET;

        if (null !== $route = $this->matchStaticRoute($path, $method)) {
            return $route;
        }

        return $this->matchDynamicRoute($path, $method);
    }
public function matchRoute(string $path, string $method = null): ? Route
    {
        // Validate the path
        $path   = $this->validatePath($path);
        $method = $method ?? RequestMethod::GET;

        if (null !== $route = $this->matchStaticRoute($path, $method)) {
            return $route;
        }

        return $this->matchDynamicRoute($path, $method);
    }
public function matchRoute ( string $ path , string $ method = null ) : ? Route { // Validate the path $ path = $ this -> validatePath ( $ path ) ; $ method = $ method ?? RequestMethod :: GET ; if ( null !== $ route = $ this -> matchStaticRoute ( $ path , $ method ) ) { return $ route ; } return $ this -> matchDynamicRoute ( $ path , $ method ) ; }
Get a route by path.

@param string $path   The path
@param string $method [optional] The method type of get

@throws \InvalidArgumentException

@return null|Route
The route if found or null when no static route is
found for the path and method combination specified
Get a route by path .