src/includes/classes/Core/Utils/UrlScheme.php
public function set(string $url, string $scheme = ''): string
    {
        if (!$scheme || $scheme === '//') {
            $scheme = '//'; # Inherits.
        } elseif ($scheme === 'current') {
            $scheme = $this->c::currentScheme();
        } elseif ($scheme === 'default') {
            $scheme = $this->App->Config->©urls['©default_scheme'];
        }
        if (!$scheme) {
            throw $this->c::issue('Empty scheme.');
        }
        if ($scheme === '//') {
            $url = preg_replace('/^'.$this::URL_REGEX_FRAG_SCHEME.'/u', '//', $url);
        } elseif ($scheme === 'relative') {
            $url = preg_replace('/^'.$this::URL_REGEX_FRAG_SCHEME.'[^\/]*/u', '', $url);
        } else {
            $url = preg_replace('/^'.$this::URL_REGEX_FRAG_SCHEME.'/u', $scheme.'://', $url);
        }
        return $url;
    }
public function set(string $url, string $scheme = ''): string
    {
        if (!$scheme || $scheme === '//') {
            $scheme = '//'; # Inherits.
        } elseif ($scheme === 'current') {
            $scheme = $this->c::currentScheme();
        } elseif ($scheme === 'default') {
            $scheme = $this->App->Config->©urls['©default_scheme'];
        }
        if (!$scheme) {
            throw $this->c::issue('Empty scheme.');
        }
        if ($scheme === '//') {
            $url = preg_replace('/^'.$this::URL_REGEX_FRAG_SCHEME.'/u', '//', $url);
        } elseif ($scheme === 'relative') {
            $url = preg_replace('/^'.$this::URL_REGEX_FRAG_SCHEME.'[^\/]*/u', '', $url);
        } else {
            $url = preg_replace('/^'.$this::URL_REGEX_FRAG_SCHEME.'/u', $scheme.'://', $url);
        }
        return $url;
    }
Set the scheme for a URL.

@since 150424 Initial release.

@param string $url    Absolute URL that includes a scheme (or a `//` scheme).
@param string $scheme ``|`//`, `current`, `default`, `relative`, `https`, `http`, or another.

@return string $url URL w/ a specific scheme.