Matches the given url against the given annotations.

@param string                    $url         The URL.
@param MatchUrlExactAnnotation[] $annotations Given annotations.

@return boolean
504039
public function matches($url, array $annotations)
	{
		foreach ( $annotations as $annotation ) {
			if ( $url === $annotation->url ) {
				return true;
			}
		}

		return false;
	}
645964
private static function getFirstAnnotationMatching(array $annotations, $annotationClass)
    {
        if (\is_string($annotationClass)) {
            $annotationClass = [$annotationClass];
        }

        foreach ($annotations as $annotation) {
            foreach ($annotationClass as $class) {
                if ($annotation instanceof $class) {
                    return $annotation;
                }
            }
        }

        return false;
    }
294599
public function match($URL, $method='get'){
      $method = strtolower($method);

      // * is an http method wildcard
      if (empty($this->methods[$method]) && empty($this->methods['*'])) return false;

      return (bool) (
        $this->dynamic
           ? preg_match($this->matcher_pattern, '/'.trim($URL,'/'))
           : rtrim($URL,'/') == rtrim($this->pattern,'/')
      );
    }
404290
public function matchWithParameters($url)
    {
        if (!$this->isAcceptedRequestMethod()
            || !$this->isPartCountSame($url)
            || !$this->hasParameters()
        ) {
            return false;
        }

        $this->extractParameterValues($url);
        $correctedUrl = $this->injectParameters($url);

        return $this->matchDirectly($correctedUrl);
    }
767093
public function matches($url, array $annotations)
	{
		foreach ( $annotations as $annotation ) {
			if ( $this->matchComponent($annotation, $url) ) {
				return true;
			}
		}

		return false;
	}
764161
public function match($url = null)
    {
        $match = parent::match($url);

        $find = $this->replaceParameters();

        if (false !== $find || true === $match) {
            return true;
        } else {
            return false;
        }
    }
765434
public final static boolean isValidURL(String url) {
        if (url == null) {
            return false;
        } else {
            return Patterns.WEB_URL.matcher(url).matches();
        }
    }
690388
public function match(
        /*# string */ $httpMethod,
        /*# string */ $uriPath,
        array $parameters = []
    )/*# :  bool */ {
        $this->initResult($httpMethod, $uriPath);
        $this->getResult()->setParameters($parameters);

        $param = ['result' => $this->result];
        if ($this->trigger(self::EVENT_BEFORE_MATCH, $param) &&
            $this->matchWithCollectors() &&
            $this->trigger(self::EVENT_AFTER_MATCH, $param)
        ) {
            return true;
        }
        return false;
    }
276410
private function patternMatch($url)
    {
        $url = explode('/', $url);
        $pattern = explode('/', $this->pattern);
        $matches = true;

        if (count($url) > count($pattern)) {
            return false;
        }

        foreach ($pattern as $pkey => $pvalue) {
            if (!isset($url[$pkey])) {
                if (substr($pvalue, 0, 2) === '{?') {
                    // Piece not in URL but is optional
                    continue;
                } else {
                    // Piece not in URL and is required
                    return false;
                }
            }

            if ($pvalue != $url[$pkey] && substr($pvalue, 0, 1) != '{') {
                // Doesn't contain a required part
                return false;
            }
        }

        return $matches;
    }
736169
public function match(UrlObject $url)
    {
        $pathWithHost = $this->str($url->getHost() . $url->getPath())->trimRight('/')->val();
        $pathWithoutHost = $this->str($url->getPath())->trimRight('/')->val();

        /**
         * @var Route $route
         */
        foreach (Router::getRouteCollection()->all() as $name => $route) {
            $compiledRoute = $route->compile();

            // 1. Make sure staticPrefix and path both contain leading slash
            $staticPrefix = $compiledRoute->getStaticPrefix();
            $staticPrefix = $staticPrefix != '' && !$this->str($staticPrefix)->startsWith('/'
            ) ? '/' . $staticPrefix : $staticPrefix;
            $urlPath = $this->str($url->getPath())->startsWith('/') ? $url->getPath() : '/' . $url->getPath();

            // 2. First check the static prefix on path because we don't want to use heavy preg_matching if the prefix doesn't match
            if ($staticPrefix != '' && strpos($urlPath, $staticPrefix) !== 0) {
                continue;
            }

            // let's check the host
            if ($route->getHost() != '' && $route->getHost() != $url->getHost()) {
                continue;
            }

            // let's check schemes
            if (count($route->getSchemes()) > 0 && !in_array($url->getScheme(), $route->getSchemes())) {
                continue;
            }

            // let's check them methods
            if (count($route->getMethods()) > 0 && !in_array($this->request()->server()->requestMethod(),
                                                             $route->getMethods()
                )
            ) {
                continue;
            }

            // check if we need to match the host also
            if ($route->getHost() != '') {
                $fullPath = $pathWithHost;
            } else {
                $fullPath = $pathWithoutHost;
            }

            // 3. Check the root path
            if ($route->getPath() == '' && ($url->getPath() != '/' && $url->getPath() != '')) {
                continue;
            }

            if (!$compiledRoute->getRegex()) {
                if ($fullPath != '') {
                    continue;
                }

                // if there is no regex, that means we can only match an empty path
                $params = [];
            } else {
                // finally let's try to match the full url
                preg_match_all($compiledRoute->getRegex(), $fullPath, $matches);

                if (count($matches[0]) < 1) {

                    // if we haven't matched the url, lets see if we have all the default values for every pattern,
                    // because if we do, and since the static prefix has been matched, we can still consider the url to be
                    // matched
                    if ($compiledRoute->getDefaultRoute()) {
                        preg_match_all($compiledRoute->getRegex(), $compiledRoute->getDefaultRoute(), $matches);
                        if (count($matches[0]) < 1) {
                            continue;
                        }
                    } else {
                        continue;
                    }
                }

                // if we matched the route, we need to extract the parameters
                $params = $this->extractParameters($matches, $compiledRoute);
            }

            return new MatchedRoute($route, $params);
        }

        return false;
    }
594715
public function compareUrlToHosts(IUrl $url, array $hosts) {
        if (count($hosts) == 0) {
            return true;
        }

        return array_contains($hosts, $url->getHost());
    }
989161
protected function matchTokens(array $pathTokens, array $patternTokens)
    {
        $matches = [];
        for ($i = 1; $i < count($patternTokens); $i++) {
            $pathToken = $pathTokens[$i];
            $patternToken = $patternTokens[$i];
            if ($pathToken == '' && $patternToken != '') {
                return false;
            }
            if ($patternToken == '*') {
                continue;
            }
            if (substr($patternToken, 0, 1) == '{') {
                $matches[substr($patternToken, 1, -1)] = urldecode($pathToken);
            } else if (urldecode($pathToken) != $patternToken) {
                return false;
            }
        }
        if (empty($matches)) {
            return true;
        }
        return $matches;
    }
139045
public function hasAnnotation(string $annotation, string $value = null): bool
    {
        $pattern = sprintf(
            '/@%s%s/',
            $annotation,
            null !== $value ? "[\s]+$value" : '\b'
        );

        return 1 === preg_match($pattern, $this->docBlock);
    }
191442
protected function _matchUrl($url, array $regexRules) {
		foreach ($regexRules as $regexRule) {
			if (preg_match('~' . $regexRule . '~imu', $url, $match)) {
				return $match;
			}
		}
		return [];
	}
108175
public function matchUrl($method, $url) {
		if ($this->method == $method) {
			if (preg_match('/^' . $this->url . '$/', $url, $matches)) {
				$params = $this->prepareParams($matches);
				$this->execute($params);
				return true;
			}
			return false;
		}
	}
1288812
public function isMatching($url)
    {
        if ($this->getRegex() === null) {
            return true;
        }

        if (preg_match($this->getRegex(), $url)) {
            return true;
        }

        return false;
    }
1068819
protected function matchUrlWithParameters($url)
    {
        foreach ($this->routes as $route) {
            if ($route->matchWithParameters($url)) {
                return $route;
            }
        }
        return null;
    }