Prepare a URL.

@param string $url The relative URL

@return string

@throws \RuntimeException If empty or malformed relative URL
357064
protected function prepareUrl($url)
    {
        if (empty($url)) {
            throw new \RuntimeException(sprintf('Empty URL at item with id: "%s"', $this->getId()));
        }

        if (stripos($url, '://') !== false) {
            throw new \RuntimeException(sprintf('Malformed relative URL at item with id: "%s"', $this->getId()));
        }

        if (stripos($url, '/') !== 0) {
            throw new \RuntimeException(sprintf('Relative URL must start with "/" at item with id: "%s"', $this->getId()));
        }

        return $url;
    }
623194
private function buildUrl($url)
    {
        if (!is_array($url)) {
            if (strpos($url, '://')) {
                return (string) $url;
            }
            return (string) $this->baseUrl->combine($url);
        } elseif (strpos($url[0], '://')) {
            return \GuzzleHttp\uri_template($url[0], $url[1]);
        }

        return (string) $this->baseUrl->combine(
            \GuzzleHttp\uri_template($url[0], $url[1])
        );
    }
80070
public function url($url = null)
    {
        if ($url === null) {
            return $this->_url;
        }
        $this->_url = $url;

        return $this;
    }
893400
private function _parseUrl($url) {
    $parse = parse_url($url);
    if (empty($parse) || !is_array($parse)) {
      throw new Exception("Host is empty.");
    }

    if (!isset($parse['port']) || !$parse['port']) {
      $parse['port'] = '80';
    }

    $parse['host'] = str_replace(
        array('http://', 'https://'),
        array('', 'ssl://'),
        $parse['scheme'] . "://"
    ) . $parse['host'];

    $parse["path"] = isset($parse["path"]) ? $parse["path"] : '/';
    $query = isset($parse['query']) ? $parse['query'] : '';

    $path = str_replace(array('\\', '//'), '/', $parse['path']);
    $parse['path'] = $query ? $path . "?" . $query : $path;

    return $parse;
  }
256400
public function buildUrl(string $url): string
    {
        if (filter_var($url, FILTER_VALIDATE_URL)) {
            return $url;
        }
        return $this->endPoint . static::ENDPOINT_SUFFIX . $url;
    }
657645
public function setUrl($url)
    {
        // validate url
        if (filter_var($url, FILTER_VALIDATE_URL)) {
            $this->url = $url;
        } else {
            throw new InvalidUrlException('"' . $url . '" is not a valid URL');
        }

        return $this;
    }
347777
public static function getDomainFromURL($url)
	{
		$url = str_replace(self::getProtocolFromURL($url) . '://', '', $url);
		
		return explode('/', $url)[0];
	}
788056
public static URL getUrl(String url) {
    try {
      return new URL(url);
    } catch (MalformedURLException e) {
      throw new RuntimeException(e);
    }
  }
1039702
public function initURL($url)
    {
        $contents = file_get_contents($url);

        $lines = explode("\n", $contents);

        return $this->initLines($lines);
    }
63577
public function setUrl($url)
    {
        if (!empty($url) && ctype_print($url)) {
            $this->url = trim($url);
        }

        return $this;
    }
1125400
private function createUrl(string $url): Url
    {
        $url = new Url($url);

        if ((new SchemeLess)->isSatisfiedBy($url)) {
            $url = $url->appendScheme(
                new Scheme($this->schemes[0] ?? 'http')
            );
        }

        return $url;
    }
286853
public static function getUrlWithProtocol($url) {
		if(empty($url)) {
			return $url;
		}
		list($scheme, $host) = self::splitUrl($url);
		if(empty($scheme) || empty($host)) {
			return '';
		}
		return $scheme.'://'.$host;
	}
940300
protected function formatUrl(string $url): string
    {
        return Str::startsWith($url, '/')
            ? $this->app['url']->to($url)
            : $url;
    }
1091628
public function prepUrl($url)
	{
        if (empty($url)) {
            return '';
        }

        return parse_url($url, PHP_URL_SCHEME) === null ? 'http://' . $url : $url;
	}
1249267
public function setUrl( $url )
    {
        if( $url==null )
        {
            return null;
        }

        $urlParts = parse_url( $url );

        $this->scheme = $urlParts['scheme'];
        $this->host = $urlParts['host'];
        $this->user = $urlParts['user'];
        $this->password = $urlParts['pass'];
        $this->path = $urlParts['path'];
        $this->query = $urlParts['query'];
        $this->fragment = $urlParts['fragment'];
        $this->port = $urlParts['port'];

        return $this;
    }
1089956
protected function prepareUrl($url)
    {
        if (Str::startsWith($url, '/')) {
            $url = substr($url, 1);
        }

        if (! Str::startsWith($url, 'http')) {
            $url = sprintf("%s/%s", $this->baseUrl(), $url);
        }

        return trim($url, '/');
    }
1245361
public function buildUrl($url)
    {
        if (strncmp($url, '/', 1) === 0) {
            return $url;
        }
        $baseUrl = isset($this->grid->controllerUrl) ? $this->grid->controllerUrl : '';

        return $baseUrl ? Url::to($baseUrl . '/' . $url) : Url::to($url);
    }