Check whether or not the URL's HTTP method matches.

@param array $url The array for the URL being generated.
@return bool
168264
protected function _matchMethod($url)
    {
        if (empty($this->defaults['_method'])) {
            return true;
        }
        // @deprecated The `[method]` support should be removed in 4.0.0
        if (isset($url['[method]'])) {
            deprecationWarning('The `[method]` key is deprecated. Use `_method` instead.');
            $url['_method'] = $url['[method]'];
        }
        if (empty($url['_method'])) {
            $url['_method'] = 'GET';
        }
        $methods = array_map('strtoupper', (array)$url['_method']);
        foreach ($methods as $value) {
            if (in_array($value, (array)$this->defaults['_method'])) {
                return true;
            }
        }

        return false;
    }
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);
    }
17853
public function isBroken($url)
    {
        if (!$domain = parse_url($url, PHP_URL_HOST)) {
            return true;
        }

        if(in_array($domain, (array) apply_filters('brokenLinks/External/ExceptedDomains', array()))) {
            return false;
        }

        // Convert domain name to IDNA ASCII form
        if(count(explode('.', $domain)) == count(array_filter(explode('.', $domain),
            function($var) {
                if(strlen($var) < 1) {
                    return false; 
                }
                return true; 
            })))  
        {
            try {
                $punycode = new Punycode();
                $domainAscii = $punycode->encode($domain);
                $url = str_ireplace($domain, $domainAscii, $url);
            } catch (Exception $e) {
                return false;
            }
        }

        // Test if URL is internal and page exist
        if ($this->isInternal($url)) {
            return false;
        }

        // Validate domain name
        if (!$this->isValidDomainName(isset($domainAscii) ? $domainAscii : $domain)) {
            return true;
        }

        // Test if domain is available
        return !$this->isDomainAvailable($url);
    }
843676
public static function online(string $url): bool
    {
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_NOBODY, true);
        curl_exec($ch);
        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch);
        if ($code === 200):
            return true;
        endif;

        return false;
    }
581041
public function has($crawlUrl): bool
    {
        if (! $crawlUrl instanceof CrawlUrl) {
            $crawlUrl = CrawlUrl::create($crawlUrl);
        }

        if ($this->contains($this->urls, $crawlUrl)) {
            return true;
        }

        return false;
    }
1341152
public function match($url)
    {
        if (!$this->schemes) {
            return true;
        }

        foreach ($this->schemes as $scheme) {
            if ($scheme->match($url)) {
                return true;
            }
        }

        return false;
    }
306151
public static function isExternalUrl($url)
    {
        /*
         * Unknown url or it's just slash?
         * Nothing to do
         */
        if (empty($url) || '/' === $url) {
            return false;
        }

        $currentUrl = self::getServerNameOrIp(true);
        $url = self::replenishProtocol($url);

        // Let's prepare pattern of current url
        $search = [
            ':',
            '/',
            '.',
        ];

        $replace = [
            '\:',
            '\/',
            '\.',
        ];

        $currentUrlPattern = str_replace($search, $replace, $currentUrl);

        return !Regex::contains($url, $currentUrlPattern);
    }
1355678
protected function checkUrl($url)
    {
        if ($this->fullName) {
            $pos = strpos($this->fullName, '<');

            if (false !== $pos) {
                $str = substr($this->fullName, 0, $pos);
            } else {
                $str = $this->fullName;
            }

            if ($str && 0 !== stripos(str_replace('|', '/', $url), $str)) {
                return false;
            }
        }

        return true;
    }
423090
protected function isRedirectionUrlValid(string $url)
    {
        // No http or https
        if (stripos(trim($url), "http")===0){
            return false;
        }

        // In fact no scheme:// at all thanks.
        if (stripos($url, "://")!==false){
            return false;
        }

        return true;
    }
16907
public function matches($url)
    {
        $infos = parse_url($url);

        if ($this->expired()) {
            return false;
        }

        if (!$this->matchesScheme($infos['scheme'])) {
            return false;
        }

        if (!$this->matchesDomain($infos['host'])) {
            return false;
        }

        return $this->matchesPath($infos['path']);
    }
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,'/')
      );
    }
1158938
public static function is_external_url($url)
    {
        if (\parse_url($url, PHP_URL_HOST) === Request::get_host()) {
            return false;
        }

        if (\strpos($url, "/") === 0) {
            return false;
        }

        return true;
    }
1085159
public function verify($url)
    {
        $url = parse_url($url);
        if ($url === false) {
            throw new \Exception('Bad url to match (not an url ?)');
        }

        $path = isset($url['path']) ? $url['path'] : '';

        if ((bool) preg_match($this->pattern, $path, $matches)) {
            array_shift($matches);

            foreach ($matches as $position => $value) {
                $this->parameterCollection->getByPosition($position)
                    ->setValue($value);
            }

            return true;
        }

        return false;
    }
173844
public function contains($url)
	{
		$url = trim($url, '/');

		foreach ($this->entries as $entry) {
			if ($entry['loc'] == $url) {
				return TRUE;
			}
		}

		return FALSE;
	}
231645
public static function isLocalUrl($url)
    {
        if (empty($url)) {
            return true;
        }

        // handle host name mangling
        $requestUri = isset($_SERVER['SCRIPT_URI']) ? $_SERVER['SCRIPT_URI'] : '';
        $parseRequest = @parse_url($requestUri);
        $hosts = array(self::getHost(), self::getCurrentHost());
        if (!empty($parseRequest['host'])) {
            $hosts[] = $parseRequest['host'];
        }

        // drop port numbers from hostnames and IP addresses
        $hosts = array_map(array('self', 'getHostSanitized'), $hosts);

        $disableHostCheck = Config::getInstance()->General['enable_trusted_host_check'] == 0;
        // compare scheme and host
        $parsedUrl = @parse_url($url);
        $host = IPUtils::sanitizeIp(@$parsedUrl['host']);
        return !empty($host)
        && ($disableHostCheck || in_array($host, $hosts))
        && !empty($parsedUrl['scheme'])
        && in_array($parsedUrl['scheme'], array('http', 'https'));
    }
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;
    }
922341
public function match(string $url, array $filters = array()): bool{
		//Check filters
		foreach($filters as $key => $value){
			if(!isset($this->filters[$key]))
				return false;

			if(!in_array($value, $this->filters[$key]))
				return false;
		}
		
		//Check url
		$url = trim($url, '/');
		$path = preg_replace_callback('#:([\w]+)#', array($this, 'paramMatch'), $this->path);
		$regex = "#^$path$#i";
		if(!preg_match($regex, $url, $matches))
			return false;

		array_shift($matches);
		$this->matches = $matches;
		return true;
	}