Valid if current provided string is an URL
@param string $url
@return bool
484044
public static function isURL(string $url): bool {
        return (boolean) !(filter_var($url, FILTER_SANITIZE_URL | FILTER_VALIDATE_URL) === false);
    }
329334
public function supports($url)
    {
        $error = $this->validator->validate($url, [new Url()]);

        return 0 === count($error);
    }
886706
public function verify($url = null) {
    if($url === null) {
      $url = $_SERVER['REQUEST_URI'];
    }

    $part = parse_url($url);

    if(isset($part['query'])) {
      parse_str($part['query'], $query);
    }

    if(!isset($query[$this->getParam])) {
      return false;
    }

    $request = $this->getRequest($url);
    if($this->gettoken($request) === $query[$this->getParam]) {
      return true;
    }
    return false;
  }
981034
protected function urlParts(string $url)
    {
        if (false === filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED)) {
            return false;
        }
        return parse_url($url) ?: false;
    }
754696
public static function parseUrl($url)
    {
        if (!\is_string($url)) {
            throw new \InvalidArgumentException('URL must be a string');
        }

        $encodedUrl = preg_replace_callback(
            '%[^:/@?&=#]+%u',
            function ($matches) { return rawurlencode($matches[0]); },
            $url
        );

        $parts = \is_string($encodedUrl) ? parse_url($encodedUrl) : false;
        if ($parts === false) {
            throw new \InvalidArgumentException("Malformed URL: {$url}");
        }

        return $parts;
    }
32876
private function validateUrl($url)
    {
        // Check for feed URL
        $url = trim($url);
        if ('feed://' === strtolower(substr($url, 0, 7))) {
            $url = 'http://' . substr($url, 7);
        }

        if (!preg_match('!^https?://.+!i', $url)) {
            $url = 'http://' . $url;
        }

        // explode url to convert accents
        $parsedUrl = parse_url($url);

        if (false === $parsedUrl) {
            throw new \Exception(sprintf('Url "%s" is not valid.', $url));
        }

        if (isset($parsedUrl['host']) && preg_match('/[\x80-\xff]/', $parsedUrl['host'])) {
            $parsedUrl['host'] = $this->punycode->encode($parsedUrl['host']);
        }

        if (isset($parsedUrl['path']) && preg_match('/[\x80-\xff]/', $parsedUrl['path'])) {
            $path = [];
            foreach (explode('/', $parsedUrl['path']) as $value) {
                $path[] = urlencode($value);
            }
            $parsedUrl['path'] = implode('/', $path);
        }

        // everything should be converted, rebuild the final url
        $url = $this->unparseUrl($parsedUrl);

        if (false === filter_var($url, FILTER_VALIDATE_URL)) {
            throw new \Exception(sprintf('Url "%s" is not valid.', $url));
        }

        $url = filter_var($url, FILTER_SANITIZE_URL);

        if (false === $this->isUrlAllowed($url)) {
            throw new \Exception(sprintf('Url "%s" is not allowed to be parsed.', $url));
        }

        return $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);
    }
596448
public static function isInternal($url)
    {
        $relative = static::makeRelative($url);

        if (substr($relative, 0, 1) !== '/') {
            return false;
        }

        $path = static::getInternalPath($relative);

        return !URLFacade::isAvailable($path);
    }
1231812
public function validRedirectUrl($url)
    {
        $root = $this->app->uri->root;

        if (strpos($url, '/') === 0) {
            return $url;
        }

        if (stripos($url, $root) !== 0) {
            return $root;
        }

        return $url;
    }
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;
    }
758769
public function hostExists($url)
    {
        if (strpos($url, '/') === false) {
            $server = $url;
        } else {
            $server = @parse_url($url, PHP_URL_HOST);
        }
        if (!$server) {
            return false;
        }
        $ips = gethostbynamel($server);

        return !empty($ips);
    }
1143474
protected function compare($url)
    {
        $activeMenuRouteUrl = $this->getActiveMenuRoute();
        if ($this->url == $url or $url == $activeMenuRouteUrl) {
            return true;
        }
        $segments = $this->segments;
        $count    = count($segments);
        if ($count !== count(array_filter(explode('/', str_replace(url('/'), '', $url))))) {
            return false;
        }

        $segmented = url('/') . '/' . implode('/', array_slice($segments, 0, $count - 1));
        if (count($segments) > 2 && starts_with($url, $segmented)) {
            return true;
        }
        @list($domain, $area, $module, $action) = explode('/', str_replace('http://', '', $url));
        if (!isset($segments[1])) {
            return false;
        }
        return ($segments[1] == $module && isset($segments[2]) && (in_array($segments[2], ['index', 'edit']) or is_numeric($segments[2])));
    }
267953
protected function isValidUrl($url)
    {
        $valid = false;

        $parseUrl = parse_url($url);

        if(isset($parseUrl['host']) || !empty($parseUrl['host'])) {

            $uri = new \Zend\Validator\Uri();
            if ($uri->isValid($url)) {
                $valid = true;
            }
            else {
                $valid = false;
            }
        }

        return $valid;
    }
520311
public function getDesiredUrl(?string $url = null)
  {
    if (isset($_GET['url'])) {
      $url = $_GET['url'] . (count($_GET) > 0 ? '?' : '');
      unset($_GET['url']);

      foreach ($_GET as $key => $value) {
        $url .= (ends_with($url, '?') ? '' : '&') . $key . '=' . $value;
      }
    }

    if ($url != null) return $url;
    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);
    }
863669
public function validate($url)
    {
        $url = UrlImmutable::createFromUrl($url);

        $query = $url->getQuery();

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

        $expiration = $query[$this->expiresParameter];

        if (!$this->isFuture($expiration)) {
            return false;
        }

        if (!$this->hasValidSignature($url)) {
            return false;
        }

        return true;
    }
639656
public static function url(string $value):bool
    {
        $value = (string)$value;
        $valid = filter_var($value, FILTER_VALIDATE_URL);
        return $valid !== false;
    }