private function applyBaseUrl(string $url): string
    {
        if ($this->baseUrl === null) {
            return $url;
        }

        if (substr($url, 0, 7) === "http://") {
            return $url;
        }

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

        $baseUrl = $this->baseUrl;

        if (substr($url, 0, 1) === "/") {
            $path = parse_url($baseUrl, \PHP_URL_PATH);
            if ($path !== null) {
                $baseUrl = substr($baseUrl, 0, strlen($path) * -1);
            }
        }

        return "{$baseUrl}/" . ltrim($url, "/");
    }
private function applyBaseUrl(string $url): string
    {
        if ($this->baseUrl === null) {
            return $url;
        }

        if (substr($url, 0, 7) === "http://") {
            return $url;
        }

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

        $baseUrl = $this->baseUrl;

        if (substr($url, 0, 1) === "/") {
            $path = parse_url($baseUrl, \PHP_URL_PATH);
            if ($path !== null) {
                $baseUrl = substr($baseUrl, 0, strlen($path) * -1);
            }
        }

        return "{$baseUrl}/" . ltrim($url, "/");
    }
private function applyBaseUrl ( string $ url ) : string { if ( $ this -> baseUrl === null ) { return $ url ; } if ( substr ( $ url , 0 , 7 ) === "http://" ) { return $ url ; } if ( substr ( $ url , 0 , 8 ) === "https://" ) { return $ url ; } $ baseUrl = $ this -> baseUrl ; if ( substr ( $ url , 0 , 1 ) === "/" ) { $ path = parse_url ( $ baseUrl , \ PHP_URL_PATH ) ; if ( $ path !== null ) { $ baseUrl = substr ( $ baseUrl , 0 , strlen ( $ path ) * - 1 ) ; } } return "{$baseUrl}/" . ltrim ( $ url , "/" ) ; }
Ensure the passed url uses the current base.

@param string $url The URL to convert

@return string
Ensure the passed url uses the current base .