{@inheritdoc}

@see \Concrete\Core\Routing\RouterInterface::matchRoute()
163800
public function matchRoute(Request $request)
    {
        $attributes = [];
        $route = $this->getRouteByPath($request->getPathInfo(), (new RequestContext())->fromRequest($request), $attributes);
        $request->attributes->add($attributes);
        $request->attributes->set('_route', $route);

        return new MatchedRoute($route, $attributes);
    }
461169
public function matchRequest(Request $request)
    {
        try {
            $parameters = parent::matchRequest($request);
            $this->matchedRouteRequest = $request;
            return $parameters;
        } catch (\Exception $e) {
            throw $e;
        }


    }
981880
public function match($path, RouteRequest $request = null)
    {
        $requestMethod = null;

        if ($request) {

            $requestMethod = self::convertRequestMethodConstant($request->getRequestMethod());

        } else if (isset($_SERVER['REQUEST_METHOD'])) {

            $requestMethod = self::convertRequestMethodConstant($_SERVER['REQUEST_METHOD']);

        }

        foreach ($this->routes as $route) {
            // If the route is using pcre pattern marching...
            if ($route[0]) {
                if (!preg_match($route[1], $path, $matches)) {
                    continue;
                }
                $route[3]['vars'] = $matches;

                // validate request method
                if (isset($route[3]['method']) && $route[3]['method'] != $requestMethod) {
                    continue;
                }
                if (isset($route[3]['domain']) && $route[3]['domain'] != $_SERVER['HTTP_HOST']) {
                    continue;
                }
                if (isset($route[3]['secure']) && $route[3]['secure'] && $_SERVER['HTTPS']) {
                    continue;
                }

                return $route;
            } else {
                // prefix match is used when expanding is not enabled.
                if ((
                        (is_int($route[2]) || $route[2] instanceof self || $route[2] instanceof \PHPSGI\App)
                        && strncmp($route[1], $path, strlen($route[1])) === 0
                    ) || $route[1] == $path) {
                    // validate request method
                    if (isset($route[3]['method']) && $route[3]['method'] != $requestMethod) {
                        continue;
                    }
                    if (isset($route[3]['domain']) && $route[3]['domain'] != $_SERVER['HTTP_HOST']) {
                        continue;
                    }
                    if (isset($route[3]['secure']) && $route[3]['secure'] && $_SERVER['HTTPS']) {
                        continue;
                    }

                    return $route;
                }
                continue;
            }
        }
    }
830266
function matchRoutes(routes, path, query) {
  query = query === undefined ? {} : isString(query) ? qs.parse(query) : query;
  return matchRoutesImpl(routes, path, query);
}
21991
public function matchRoute(ResultInterface $result)/*# : bool */
    {
        // skip if path prefix not match
        if (!$this->matchPathPrefix($result->getPath())) {
            return false;
        }

        // match with each routes in the collector
        return $this->realMatchRoute($result);
    }
756252
public function matches(Route $route, Request $request)
    {
        $regex = $route->getCompiled()->getHostRegex();

        if (is_null($regex)) return true;

        return preg_match($regex, $request->getHost());
    }
1128724
public function match(BuiltRoute $route, $path, $verb)
    {
        /**
         * Normalize path. Same functionality is found
         * in Route#normalizePath.
         */
        $normalizedPath = trim($path, '/') ?: '/';
        if (substr($normalizedPath, 0, 1) != '/') {
            $normalizedPath = '/' . $normalizedPath;
        }
        
        if (!in_array(strtolower($verb), $route->via())) {
            return false;
        }
        
        $regex = $route->pathRegex();
        
        if (!preg_match($regex, $normalizedPath, $m)) {
            return false;
        }
        
        array_shift($m);
        
        $vars      = $route->vars();
        $params    = [];
        $varsNames = array_keys($vars);
        
        foreach ($m as $k => $value) {
            if (isset($vars[$varsNames[$k]]['constraint'])) {
                if (substr($vars[$varsNames[$k]]['constraint'], 0, 1) == '/') {
                    if (!preg_match($vars[$varsNames[$k]]['constraint'], $value)) {
                        return false;
                    }
                } else {
                    if ($value !== (string)$vars[$varsNames[$k]]['constraint']) {
                        return false;
                    }
                }
            }
            $params[$varsNames[$k]] = $value;
        }
        
        /**
         * Fill missing route variables with their
         * default values, if any.
         */
        $missingVars = array_diff($varsNames, array_keys($params));
        if ($missingVars && $route->defaults()) {
            foreach ($route->defaults() as $varName => $value) {
                if (in_array($varName, $missingVars)) {
                    $params[$varName] = $value;
                }
            }
        }
        
        return $params;
    }
474518
protected function match($method, $uri)
    {
        $result = null;

        foreach ((array) $this->router->routes() as $route)
        {
            $matched = preg_match($route->regex(), $uri, $matches);

            if ($matched && $route->method() === $method)
            {
                return array($matches, $route);
            }
        }

        return $result;
    }
185137
public function findMatchingPaths(Route $searchRoute)
    {
        if (isset($this->cachedRoutes[$searchRoute->getPath()])) {
            return $this->cachedRoutes[$searchRoute->getPath()];
        }

        /** @var Route $route */
        foreach ($this->getSortedRoutes() as $routePath => $name) {
            if (preg_match('#^' . preg_quote(rtrim($routePath, '/') . '/', '#') . '#', $searchRoute->getPath())) {
                $this->cachedRoutes[$searchRoute->getPath()] = $name;

                return $name;
            }
        }

        return null;
    }
1135940
public function match($methods, $uri, $action)
    {
        return $this->router->match($methods, $uri, $action);
    }
1336278
private function matchesRequest($route)
    {
        $requestURL = $this->requestURL;
        if (isset($route['fullDomainMatch']) && $route['fullDomainMatch'] == true) {
            $requestURL = $this->fullRequestURL;
        }
        if (isset($route['method']) && $route['method'] != $this->requestMethod) {
            return false;
        }
        return preg_match($route['match'], $requestURL, $this->matches);
    }
953940
protected function getRouteMatch(RequestInterface $request) : Match
	{
		/** @var Router $router */
		$router = $this->dependencyContainer->get('fuel.application.router');
		$match = $router->translate($request->getUri()->getPath(), $request->getMethod());

		return $match;
	}
586894
protected function matchRoute(array $routes, $method, IUrl $url) {
        foreach ($routes as $route) {
            if ($this->compareRouteToMethod($route, $method) &&
                $this->getUrlMatcher()->match($route->getPath(), $url->getPath()) &&
                $this->getRestrictionsMatcher()->match($url)
            ) {
                $parameters = $this->getUrlMatcher()
                    ->parse($route->getPath(), $url->getPath());

                $route->setParameters($parameters->toArray());

                return $route;
            }
        }

        return null;
    }
432403
public function match(Context $context)
    {
        $name = $this->getName($context);

        if ($this->map->hasRoute($name)) {
            return $this->map->getRoute($name);
        }

        return false;
    }
1328009
public function match(ServerRequestInterface $request) : RouterMatch
    {
        $path = $request->getUri()->getPath();
        $syContext = new RequestContext('/');
        $syMatcher = new UrlMatcher($this->syRouteCollection, $syContext);
        try {
            $params = $syMatcher->match($path);
        } catch (\Throwable $e) {
            throw new HttpException(404, "No route matched for path $path",
                null, $e);
        }
        
        $matchedRouteName = $params['_route'];
        unset($params['_route']);
        $route = $this->routeProvider->getRouteFromName($matchedRouteName);
        $routerMatch = new RouterMatch($route, $params);
        return $routerMatch;
    }
1196874
protected function matchNestedRouters(
        $method,
        IUrl $url,
        array &$exceptions,
        IRoute $route = null
    ) {
        foreach ($this->getNestedRouters() as $router) {
            $match = $router->matchRouter($method, $url, $exceptions, $route);

            if ($match !== null) {
                $route = $match;
                break;
            }
        }

        return $route;
    }
140535
public function getMatchedRouteName()
    {
        if ($this->isFailure()) {
            return false;
        }
        if (! $this->matchedRouteName && $this->route) {
            $this->matchedRouteName = $this->route->getName();
        }

        return $this->matchedRouteName;
    }