Returns true if matches request, otherwise returns false

@param RequestInterface $request

@return bool
19216
public function match(RequestInterface $request)
    {
        return (
            $this->matchSchema($request->schema()) &&
            $this->matchMethods($request->method()) &&
            $this->matchHost($request->host()) &&
            $this->matchPath($request->path())
        );
    }
797970
private static function isValidOrigin(RequestInterface $request): bool
    {
        if (!self::compareHeaderUrl($request, 'Origin')) {
            return false;
        }

        if (!self::compareHeaderUrl($request, 'Referer')) {
            return false;
        }

        return true;
    }
197670
protected function matchRequest(SiteInterface $site, Request $request)
    {
        $results = [];

        // we read the value from the attribute to handle fragment support
        $requestPathInfo = $request->get('pathInfo', $request->getPathInfo());

        if (!preg_match(sprintf('@^(%s)(/.*|$)@', $site->getRelativePath()), $requestPathInfo, $results)) {
            return false;
        }

        return $results[2];
    }
816292
protected function authenticateRequest(RequestInterface $request)
    {
        $uri = $request->getUri();
        parse_str($uri->getQuery(), $query);

        $query['key'] = Configuration::get('key');
        $query['token'] = Configuration::get('token');

        $uri = $uri->withQuery(http_build_query($query));

        return $request->withUri($uri);
    }
1193925
public function isAjax($request = null)
    {
        if ($this->isSingle()) {
            return $request ? $request->isAjax() : RequestKit::isAjax();
        }
        return false;
    }
194682
public function shouldPrerenderPage(RequestInterface $request)
    {
        if (!$request instanceof HttpRequest) {
            return false;
        }

        // First, return false if User Agent is not a bot
        if (!$this->isCrawler($request)) {
            return false;
        }

        $uri = $request->getUriString();

        // Then, return false if URI string contains an ignored extension
        foreach ($this->moduleOptions->getIgnoredExtensions() as $ignoredExtension) {
            if (strpos($uri, $ignoredExtension) !== false) {
                return false;
            }
        }

        // Then, return true if it is whitelisted (only if whitelist contains data)
        $whitelistUrls = $this->moduleOptions->getWhitelistUrls();

        if (!empty($whitelistUrls) && !$this->isWhitelisted($uri, $whitelistUrls)) {
            return false;
        }

        // Finally, return false if it is blacklisted (or the referer)
        $referer       = $request->getHeader('Referer') ? $request->getHeader('Referer')->getFieldValue() : null;
        $blacklistUrls = $this->moduleOptions->getBlacklistUrls();

        if (!empty($blacklistUrls) && $this->isBlacklisted($uri, $referer, $blacklistUrls)) {
            return false;
        }

        return true;
    }
982275
public function matchMethod(RequestInterface $request, array $maps)
    {
        $matched = [];

        $method = $request->getMethod();

        /** @var RequestMap $map */
        foreach ($maps as $map) {
            if ($map->getRequest()->getMethod() === $method) {
                $matched[] = $map;
            }
        }

        return $matched;
    }
1050628
public function matches( Route $route, Request $request )
	{
		if ( $route->httpOnly() )
			return !$request->secure();
		elseif ( $route->secure() )
			return $request->secure();

		return true;
	}
157154
public function match( Request $request )
	{
		$routes = $this->get( $request->getMethod() );

		// First, we will see if we can find a matching route for this current request
		// method. If we can, great, we can just return it so that it can be called
		// by the consumer. Otherwise we will check for routes with another verb.
		$route = $this->check( $routes, $request );

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

		// If no route was found we will now check if a matching route is specified by
		// another HTTP verb. If it is we will need to throw a MethodNotAllowed and
		// inform the user agent of which HTTP verb it should use for this route.
		$others = $this->checkForAlternateVerbs( $request );

		if ( count( $others ) > 0 )
		{
			return $this->getRouteForMethods( $request, $others );
		}

		throw new NotFoundHttpException;
	}
805939
public function send(RequestInterface $request)
	{
		$request = $this->authentication($request);
		$defaultHeaders = [
			'Accept'       => $this->getContentType(),
			'Content-Type' => $this->getContentType()
		];

		foreach ($defaultHeaders as $defaultHeader => $value)
		{
			if ( ! $request->hasHeader($defaultHeader))
			{
				$request = $request->withHeader($defaultHeader, $value);
			}
		}

		$response = $this->client->sendRequest($request);
		$response = $this->transformResponseToException($request, $response);

		return $response;
	}
419541
public function matchesPattern(Request $request)
    {
        if (preg_match($this->regexPattern, $request->getRequestUri()) <= 0) {
            return false;
        }

        return true;
    }
435701
public function match(Request $request)
    {
        $hasWpParams = $request->path() == '/' && ($request->has('p') || $request->has('post_id'));

        if ($hasWpParams && $route = $this->findMatchingWordPressPost($request)) {
            return $route;
        }

        try {
            return parent::match($request);
        } catch (NotFoundHttpException $e) {

            if ($route = $this->findMatchingWordPressPost($request)) {
                return $route;
            }

            throw $e;
        }
    }
1207922
private function isMatching(RequestInterface $request, &$route): int
    {
        $match = -1;

        $pattern = str_replace('/', '\/', trim($route['pattern'], '/'));
        $pattern = str_replace(array_keys(self::$expressions), array_values(self::$expressions), $pattern);

        if (preg_match('/^' . $pattern . '$/', ltrim($request->getUri()->getPath(), '/'), $matches)) {
            $match = $this->rate($route['target'], $matches);
        }

        return $match;
    }
1031054
public function resolvesToAsset(RequestInterface $request)
    {
        if (null === $this->asset) {
            $this->asset = $this->resolve($request);
        }

        return (bool)$this->asset;
    }
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;
    }
1199206
public function verifyAll(RequestInterface $request) {
        $passes = 0;

        $passes += (int)$this->verifyMethod($request->getMethod());
        $passes += (int)$this->verifyHTTPVersion($request->getProtocolVersion());
        $passes += (int)$this->verifyRequestURI($request->getUri()->getPath());
        $passes += (int)$this->verifyHost($request->getHeader('Host'));
        $passes += (int)$this->verifyUpgradeRequest($request->getHeader('Upgrade'));
        $passes += (int)$this->verifyConnection($request->getHeader('Connection'));
        $passes += (int)$this->verifyKey($request->getHeader('Sec-WebSocket-Key'));
        $passes += (int)$this->verifyVersion($request->getHeader('Sec-WebSocket-Version'));

        return (8 === $passes);
    }
577520
public function matchRequest(Request $request) {
        $context = new RequestContext();
        $context->fromRequest($request);
        $this->setContext($context);

        return($this->match($request->getPathInfo()));
    }