Check if a route for the URL exists

@param ServerRequestInterface $request
@return boolean
334893
public function hasRoute(ServerRequestInterface $request, $withMethod = true)
    {
        $route = $this->findRoute($request->getUri(), $withMethod ? $request->getMethod() : null);
        return isset($route);
    }
1014203
public function dispatchRequest(ServerRequestInterface $request) : ResponseInterface
    {
        $match = $this->dispatch($request->getMethod(), $request->getUri()->getPath());

        switch ($match[0]) {
            case FastRoute::NOT_FOUND:
                $this->setNotFoundDecoratorMiddleware();
                break;
            case FastRoute::METHOD_NOT_ALLOWED:
                $allowed = (array) $match[1];
                $this->setMethodNotAllowedDecoratorMiddleware($allowed);
                break;
            case FastRoute::FOUND:
                $match[1]->setVars($match[2]);
                $this->setFoundMiddleware($match[1]);
                break;
        }

        return $this->handle($request);
    }
303748
protected static function checkHttps(Request $request): bool
    {
        return $request->server->has('HTTPS') && 'on' === $request->server->get('HTTPS');
    }
1321372
private function checkRequest(ServerRequestInterface $request): bool
    {
        $contentType = $request->getHeaderLine('Content-Type');
        foreach ($this->contentType as $allowedType) {
            if (\stripos($contentType, $allowedType) === 0) {
                return true;
            }
        }
        return false;
    }
1042099
public function match(Request $request)
    {
        // Get all the routes
        $routes = $this->getByMethod($request->getMethod());

        // Get the matching route out of the collection.
        $route = $this->getMatchingRoute($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('No route was found for the given request.');
    }
889174
protected function shouldIgnore($request) : bool
  {
    $this->createUrl($request, 'except');
    if (in_array($request->path(), $this->except)) return true;

    return false;
  }
232074
public function matchRequest(RequestInterface $request)
    {
        if (!isset($this->options['cidrPattern'])) {
            throw new InvalidRequestPatternException('Missing option "cidrPattern" in the Ip request pattern configuration', 1446224520);
        }
        if (!$request instanceof ActionRequest) {
            return false;
        }
        return (boolean)IpUtility::cidrMatch($request->getHttpRequest()->getClientIpAddress(), $this->options['cidrPattern']);
    }
1212619
protected function getUrl(ServerRequestInterface $request, array $options)
    {
        $url = $options['url'];
        if ($options['queryParam'] !== null && $request->getMethod() === 'GET') {
            $query = urlencode($options['queryParam']) . '=' . urlencode($request->getRequestTarget());
            if (strpos($url, '?') !== false) {
                $query = '&' . $query;
            } else {
                $query = '?' . $query;
            }

            $url .= $query;
        }

        return $url;
    }
440432
public function resolvesToAsset(ServerRequestInterface $request)
    {
        if (null === $this->asset) {
            $this->asset = $this->resolve($request);
        }

        return (bool)$this->asset;
    }
962880
protected function findRoute(Request $request)
    {
        if (! in_array($request->method(), array('GET', 'HEAD', 'OPTIONS'))) {
            return;
        }

        $uri = $request->path();

        foreach ($this->routes as $pattern => $callback) {
            if (preg_match('#^' .$pattern .'$#s', $uri, $matches)) {
                return array($callback, array_slice($matches, 1));
            }
        }
    }
776422
public function applyStaticRouting(&$request) {
        if (isset($this->_staticRoutes[$request])) {
            $request = $this->_staticRoutes[$request];
            $request = 'app' . DS . 'pages' . DS . $request;
            return true;
        }
        return false;
    }
1117647
public static function getPathInfo(ServerRequestInterface $request)
    {
        return $request->getAttribute(self::PATH_INFO, null) ?: $request->getUri()->getPath();
    }
1337559
public function dispatch(ServerRequest $request, array $parameters = [])
    {
        $matchedRoute = $this->matcher->matchRequest($request);
        if ($matchedRoute !== false) {
            return $this->dispatcher->dispatchRoute($matchedRoute, $parameters);
        }

        return $this->dispatcher->dispatchNotFound();
    }
869011
public function matchRequest(\TYPO3\Flow\Mvc\RequestInterface $request) {
		/** @var \TYPO3\Flow\Security\RequestPatternInterface $pattern */
		foreach ($this->subPatterns as $pattern) {
			if ($pattern->matchRequest($request) === FALSE) {
				return FALSE;
			}
		}

		return TRUE;
	}
536927
protected function dispatchRouterRoute(
        ServerRequestInterface $request,
        RouterInterface $router
    ) : ServerRequestInterface {
        $routeInfo = $router->dispatch($request);
        if ($routeInfo[0] === Dispatcher::FOUND) {
            $routeArguments = [];
            foreach ($routeInfo[2] as $k => $v) {
                $routeArguments[$k] = urldecode($v);
            }

            $route = $router->getRouteByIdentifier($routeInfo[1]);
            $route->prepare($request, $routeArguments);
            /**
             * Add route to request to allow handler or other access route
             */
            $request = $request->withAttribute('route', $route);
        }

        $routeInfo['request'] = [$request->getMethod(), (string) $request->getUri()];
        return $request->withAttribute('routeInfo', $routeInfo);
    }
1150296
function match(RequestInterface $request)
    {
        $method = $request->getMethod();

        if (strtoupper($method) !== strtoupper($this->getMethod()))
            return false;

        $routeMatch = clone $this;
        return $routeMatch;
    }
444807
public final function match(ServerRequestInterface &$request): RouteInterface
   {
       foreach ($this->route as $value) {
           if ($this->matcher->match($request, $value)) {
               return $value;
           }
       }
       throw new RouterException(
           "Can't match "
         . $request->getMethod() . " "
         . $request->getUri()->getPath());
   }