Build the SSL config for the given URL.

@param  string  $url
@return string
488256
function buildCertificateConf($path, $url)
    {
        $config = str_replace('VALET_DOMAIN', $url, $this->files->get(__DIR__.'/../stubs/openssl.conf'));
        $this->files->putAsUser($path, $config);
    }
548823
public static function url($url){

		$url = static::_nullValue($url);
		if(!$url){

			return $url;
		}

		$query = parse_url($url, PHP_URL_QUERY);
		if(!$query){

			return $url;
		}

		parse_str($query, $query_parts);

		// First urldecode to be sure that we do not re-encode the query parts.
		$query_parts = array_map('static::_nested_urldecode', $query_parts);

		// http_build_query will take care of the urlencode.
		return strtok($url, '?') . '?' . http_build_query($query_parts);
	}
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])
        );
    }
298226
public function checkLink($url)
    {
        $url = trim($url);
        if (substr($url, 0, 7 ) == "http://") return $url;

        if (substr($url, 0, 8 ) == "https://") return $url;

        return "http://".$url;
    }
662180
public static function sanitizeUrl($url)
    {
        $url = trim($url);

        if (!$url) {
            return null;
        }

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

        return self::sanitizeString($url);
    }
1374581
public function parseUrl($url) {
        $region = $this->getConfig('region');
        $bucket = $this->getConfig('bucket');
        $key = $url;

        if (strpos($url, 'amazonaws.com') !== false) {

            // s3<region>.amazonaws.com/<bucket>
            if (preg_match('/^https?:\/\/s3(.+?)?\.amazonaws\.com\/(.+?)\/(.+?)$/i', $url, $matches)) {
                $region = $matches[1] ?: $region;
                $bucket = $matches[2];
                $key = $matches[3];

            // <bucket>.s3<region>.amazonaws.com
            } else if (preg_match('/^https?:\/\/(.+?)\.s3(.+?)?\.amazonaws\.com\/(.+?)$/i', $url, $matches)) {
                $bucket = $matches[1];
                $region = $matches[2] ?: $region;
                $key = $matches[3];
            }
        }

        return array(
            'bucket' => $bucket,
            'key' => trim($key, '/'),
            'region' => trim($region, '-')
        );
    }
896898
private function transformSshUrlIntoHttp($url)
    {
        $pattern = '#git@' . $this->getDomain() . ':' . self::REGEX_USER . '/' . self::REGEX_REPOSITORY . '.git$#';

        if (preg_match($pattern, $url, $matches)) {
            return sprintf(
                'https://%s/%s/%s',
                $this->getDomain(),
                $matches['user'],
                $matches['repository']
            );
        }

        return $url;
    }
166196
public static function prepareUrl($url)
    {
        // $url = urlencode($url);

        $replacement = [
            '&' => '&amp;',
            "'" => '&apos;',
            '"' => '&quot;',
            '>' => '&gt;',
            '<' => '&lt;',
        ];

        $url = str_replace(array_keys($replacement), array_values($replacement), $url);

        return $url;
    }
552249
private static function getProxyConfiguration($url)
    {
        $hostname = UrlHelper::getHostFromUrl($url);

        if (Url::isLocalHost($hostname)) {
            return array(null, null, null, null);
        }

        // proxy configuration
        $proxyHost = Config::getInstance()->proxy['host'];
        $proxyPort = Config::getInstance()->proxy['port'];
        $proxyUser = Config::getInstance()->proxy['username'];
        $proxyPassword = Config::getInstance()->proxy['password'];

        return array($proxyHost, $proxyPort, $proxyUser, $proxyPassword);
    }
1181531
public static function swap_protocol( $url ) {
		if ( stristr($url, 'http:') ) {
			return str_replace('http:', 'https:', $url);
		}
		if ( stristr($url, 'https:') ) {
			return str_replace('https:', 'http:', $url);
		}
		return $url;
	}
835037
public function setSecureUrl($url)
    {
        if (strpos($url, 'https://') !== false) {
            if (filter_var($url, FILTER_VALIDATE_URL)) {
                $this->setObject('secure_url', $url);
            }
        }

        return $this;
    }
475216
public function generateUrl($url)
    {
        $extern = false;
        if ((0 === strrpos($url, 'http://'))
            || (0 === strrpos($url, 'https://'))) {
            $extern = true;
        }

        $http = (isset($_SERVER['HTTPS'])) ? 'https://' : 'http://';

        if (!$extern) {
            return ($this->getRoot() == '/')
                ? (($this->getRoot() == $url) ? '' : $url) : $http.$_SERVER['SERVER_NAME'].$this->getRoot().$url;
        } else {
            return $url;
        }
    }
687646
public function signUrl($url)
    {
        return UrlSigner::sign($url, $this->secret, $this->clientId, $this->channel);
    }
62700
public static function normalizeURL($url)
  {
    $url_parts = self::splitURL($url);
    
    if ($url_parts == null) return null;
    
    $url_normalized = self::buildURLFromParts($url_parts, true);
    return $url_normalized;
  }
39570
private function getCurlHandle($url)
    {
        if ($curl = curl_init($url)) {
            curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 15);
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);

            if ($this->is_https && $this->verify_ssl_peer) {
                curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
                curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);

                if ($this->custom_ca_file) {
                    curl_setopt($curl, CURLOPT_CAINFO, $this->custom_ca_file);
                }
            } else {
                curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
                curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
            }

            return $curl;
        } else {
            throw new \RuntimeException("Can't create curl handle");
        }
    }
1181737
protected function parseStringUrl(?string $url) : string
    {
        $parts = parse_url($url);

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

        return $this->create(
            $parts['scheme'] ?? null,
            $parts['host'] ?? null,
            $parts['path'] ?? null,
            $query ?? null,
            $parts['fragment'] ?? null,
            (Str::endsWith($url, '/')
                && (isset($parts['path'])
                    && ($parts['path'] !== '/' || !empty($parts['path']))) )
        );
    }
848710
public static function getHostFromUrl($url)
    {
        $parsedUrl = parse_url($url);

        if (empty($parsedUrl['host'])) {
            return;
        }

        return Common::mb_strtolower($parsedUrl['host']);
    }