match uri for when( method

@param null|string $url
@return bool
513614
public function matchWhen($url = null)
    {
        if (null !== $url) {
            $this->setMatchUrl($url);
        }

        return strpos($this->getRequestedUrl(), $this->getMatchUrl()) === 0;
    }
228752
public function matches($url)
    {
        $pattern = $this->getRegexPattern();

        if (preg_match($pattern, $url, $matches)) {

            // Remove entries with int keys to filter out only named matches
            foreach ($matches as $key => $value) {
                if (is_int($key)) {
                    unset($matches[$key]);
                }
            }

            return $matches;
        }

        return false;
    }
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;
		}
	}
1353934
public function matches($url, $method)
    {
        if ($this->httpmethod !== 'ANY' && strtolower($method) !== strtolower($this->httpmethod)) {
            return false;
        }

        // Exact match OR pattern match
        return $this->pattern == $url || $this->patternMatch($url);
    }
486128
public function isUrl($url)
    {
        $path = parse_url($url, PHP_URL_PATH);
        $encoded_path = array_map('urlencode', explode('/', $path));
        $url = str_replace($path, implode('/', $encoded_path), $url);

        return filter_var($url, FILTER_VALIDATE_URL);
    }
538852
public function runUri($var1 = null, $var2 = null, $var3 = null, $var4 = null)
    {
        if (null === $var1) {
            return $this->uri;
        }

        if (\is_numeric($var1) && null === $var2) {
            return $this->parts[$var1] ?? null;
        }

        if (\is_numeric($var1) && \is_string($var2)) {
            return $this->checkUriSegmentMatch($var1, $var2, $var3, $var4);
        }

        if (\is_string($var1)) {
            return $this->checkUriRegexMatch($var1, $var2, $var3);
        }

        throw new \LogicException('Invalid use of the uri function.');
    }
738981
public function match($uri)
    {
        foreach ($this->routes as $route) {
            $result = $route->match($uri);

            if ($result == true) {
                return $route;
            }
        }
    }
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;
    }
685075
public function match($url)
    {
        if ($this->isString($url)) {
            $url = $this->url($url);
        } else {
            $url = StdObjectWrapper::isUrlObject($url) ? $url : $this->url('');
        }

        // get it from cache
        if (($result = $this->loadFromCache('match.' . $url->val())) !== false) {
            return $this->unserialize($result);
        }

        // try to match the url
        $result = $this->urlMatcher->match($url);

        // cache it
        $cacheResult = $this->isArray($result) ? $this->serialize($result) : $result;
        $this->saveToCache('match.' . $url->val(), $cacheResult);

        return $result;
    }
1302508
public static function isHttps(string $url)
    {
        $url = UrlHelper::validateUrl($url);

        $parsedUrl = parse_url($url);
        if ($parsedUrl === false) {
            throw new InvalidArgumentException("The provided url is not valid: $url");
        }

        return $parsedUrl["scheme"] === UrlHelper::HTTPS_SCHEME;
    }
67998
protected function hasRedirectUrl($url)
    {
        if (null === $this->redirectApi && 0 === strpos($url, $this->getRepositoryApiUrl())) {
            $this->redirectApi = $this->getNewRepositoryUrl();

            if (\is_string($this->redirectApi)) {
                $this->cache->write('redirect-api', $this->redirectApi);
            }
        }

        return \is_string($this->redirectApi);
    }
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);
    }
836956
protected function matchUrlDirectly($url)
    {
        foreach ($this->routes as $route) {
            if ($route->matchDirectly($url)) {
                return $route;
            }
        }
        return null;
    }
724959
public function runIfMatch($URL, $method='get'){
      return $this->match($URL,$method) ? $this->run($this->extractArgs($URL),$method) : null;
    }
986525
public function checkRoute($uri)
    {
        foreach($this->strings as $expression)
        {
            // check if it matches the pattern
            $this->regex->setPattern($expression);
            if($this->regex->getMatches($uri))
            {
                $this->matchedUriParts = explode('/',$uri);
                return true;
            }
        }
        return false;
    }
765434
public final static boolean isValidURL(String url) {
        if (url == null) {
            return false;
        } else {
            return Patterns.WEB_URL.matcher(url).matches();
        }
    }
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;
    }