Checks if route matches request.

@param  string $request [description]
@param  array  $queries [description]

@return bool
191035
public function matches($request, $queries = [])
    {
        $this->setQueries($queries);

        if (! $request && $this->isHomePath()) {
            return true;
        }

        if ($matches = preg_match("@^{$this->getPathMock($queries)}$@", $request)) {
            if ($this->rulesNotPassed()) {
                return false;
            }
        }

        return (bool) $matches;
    }
799728
private function match($request)
    {
        $route = $this->router->match(
            $request->getUri()->getPath(),
            $request->getMethod()
        );
        if (!$route) {
            // not matched. dispatch the next middleware.
            return $this->next ? $this->next->__invoke($request) : null;
        }
        return $this->dispatch($request, $route);
    }
1050628
public function matches( Route $route, Request $request )
	{
		if ( $route->httpOnly() )
			return !$request->secure();
		elseif ( $route->secure() )
			return $request->secure();

		return true;
	}
611190
public function shouldPassThrough(Request $request) : bool
    {
        if (empty($this->http_method) && empty($this->http_path)) {
            return true;
        }

        $method = $this->http_method;

        $matches = array_map(function ($path) use ($method) {
            $path = trim(config('lia.route.prefix'), '/').$path;

            if (Str::contains($path, ':')) {
                list($method, $path) = explode(':', $path);
                $method = explode(',', $method);
            }

            return compact('method', 'path');
        }, explode("\r\n", $this->http_path));

        foreach ($matches as $match) {
            if ($this->matchRequest($match, $request)) {
                return true;
            }
        }

        return false;
    }
1369769
private static function routeMatch(string $request_url, string $request_method, Route $route) :bool {

		// if the method is set for that route, and it doesn't match
		if(!$route->hasMethod($request_method)) {
			return false;
		}
		// if the url doesn't begin with the static segment or that route
		if(!$route->hasStaticUrlSegment($request_url)) {
			return false;
		}
		// if we've got a redirect, let's go for it
		$route->redirectIfItIsOne();
		// get a list of current request parameters, with numerical indexes
		$indexed_request_parameters = Request::getUrlIndexedParameters($route->staticSegment);
		// if restricttion against url parameters don't match
		if(!$route->validatesTheseParameters($indexed_request_parameters)) {
			return false;
		}
		// send the named parameters to the request class
		$route->sendNamedParametersToRequest($indexed_request_parameters);
		// deduce the dynamic action from the url parameters if necessary
		$route->deduceAction();
		// check if they match defined constraints
		return true;

	}
908289
public function find(Request $request, array $routes)
    {
        foreach ($routes as $route) {

            if(!$this->matchMethod($request, $route)){
                continue;
            }

            if(!$this->matchContentType($request, $route)){
                continue;
            }

            if(!$this->matchFilters($route)){
                continue;
            }

            $routeMatches = $this->matchPattern($request, $route);
            if ($routeMatches) {
                $route->setMatches($routeMatches);
                return $route;
            }
        }
        throw new RouteException(
            sprintf('No route found for uri "%s"', $request->getRequestUri()),
            $request,
            $routes
        );
    }
1059295
public function checkRequest($request)
    {
        $member = Member::currentUser();
        if (!$member) {
            return false;
        }

        $salt = $request->getVar('s');
        $memberSalt = $this->memberSalt($salt, $member);
        $token = $this->getToken($memberSalt);

        // Ensure tokens match
        return $token === $request->getVar('t');
    }
419541
public function matchesPattern(Request $request)
    {
        if (preg_match($this->regexPattern, $request->getRequestUri()) <= 0) {
            return false;
        }

        return true;
    }
1065021
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;
    }
37003
function match(RequestInterface $request)
    {
        if ($preReq = $this->getPreparator()) {
            $request = $preReq->withRequestOnMatch($request);

            if (! $request instanceof RequestInterface )
                throw new \RuntimeException(sprintf(
                    'Missing RequestInterface While Preparing Request Object Through (%s).'
                    , \Poirot\Std\flatten($preReq)
                ));
        }


        ## match against connected routers if exists
        if (empty($this->routesAdd))
            return false;

        # build queue list for routers to match:

        # match routes:
        $routeMatch = false;
        foreach($this->_priorityQueue() as $route) {
            /** @var iRoute $r */
            $r = $route;
            if ($routeMatch = $r->match($request)) break;
        }

        ## if route match merge stack default params with match route
        /** @var iRoute $routeMatch */
        if ($routeMatch) {
            # $routeMatch = clone $routeMatch; // this can be skipped because use of match on each route
            \Poirot\Router\mergeParamsIntoRouter($routeMatch, $this->params());
        }

        return $routeMatch;
    }
165824
public function match(Request $request)
    {
        try {
            return parent::match($request);
        } catch (NotFoundHttpException $e) {
            $route = $this->findMatchingWordpressPost();

            if ( ! is_null($route)) {
                return $route->bind($request);
            }

            throw $e;
        }
    }
642475
public function match(string $query, string $method = null)
    {
        $this->arguments = [];
        $this->methodMatched = null;
        $this->pathMatched = null;

        $matcher = new RouteMatcher();
        $res = $matcher->match(
            $this->mount,
            $this->path,
            $this->getAbsolutePath(),
            $query,
            $this->method,
            $method
        );
        $this->arguments = $matcher->arguments;
        $this->methodMatched = $matcher->methodMatched;
        $this->pathMatched = $matcher->pathMatched;

        return $res;
    }
894690
protected function check(array $routes, $request, $includingMethod = true)
    {
        return Arr::first($routes, function ($key, $route) use ($request, $includingMethod)
        {
            return $route->matches($request, $includingMethod);
        });
    }
1323747
public function match(RequestInterface $request, array &$attrs = null): bool
    {
        if (empty($this->matchers)) {
            // 不存在匹配器时始终返回 false，便于路由器继续向下探查匹配
            return false;
        }
        foreach ($this->matchers as $matcher) {
            if (!$matcher->match($request, $attrs)) {
                return false;
            }
        }
        return true;
    }
1032040
public boolean anyMatched(String[] requestPathTokens) {
		Map<String, String> pathParams = new HashMap<>();
		for (PathPattern pattern : routes.keySet()) {
			if (pattern.match(requestPathTokens, pathParams)) {
				return true;
			}

			// Reset for the next loop
			pathParams.clear();
		}

		return false;
	}
1222044
public function match(Request $request)
	{
		foreach ($this->routes->filterByMethod($request->getMethod()) as $route)
		{
			if ($route->isMatch($request->getPathInfo()))
			{
				return $route;
			}
		}

		return null;
	}
1290367
public function match(RequestInterface $request, $pathOffset = null, array $options = array()) {
		$match = $this->match_part($request, $pathOffset, $options);
		if(!empty($match)){
			$privilegeParts = explode('/', $match['params']['xelax_admin_privilege']);
			if(!isset($match['params']['action']) && array_pop($privilegeParts) != 'subroute'){
				$match['params']['action'] = '';
			}
			return new RouteMatch($match['params'], $match['length']);
		}
		return null;
	}