src/Url.php
function buildAbsolute(): string
    {
        $output = '';

        if ($this->host === null) {
            throw new IncompleteUrlException('No host specified');
        }

        // scheme
        if ($this->scheme !== null) {
            $output .= $this->scheme;
            $output .= '://';
        } else {
            // protocol-relative
            $output .= '//';
        }

        // host, port
        $output .= $this->getFullHost();

        // ensure a forward slash between host and a non-empty path
        if ($this->path !== '' && $this->path[0] !== '/') {
            $output .= '/';
        }

        // path, query, fragment
        $output .= $this->buildRelative();

        return $output;
    }
function buildAbsolute(): string
    {
        $output = '';

        if ($this->host === null) {
            throw new IncompleteUrlException('No host specified');
        }

        // scheme
        if ($this->scheme !== null) {
            $output .= $this->scheme;
            $output .= '://';
        } else {
            // protocol-relative
            $output .= '//';
        }

        // host, port
        $output .= $this->getFullHost();

        // ensure a forward slash between host and a non-empty path
        if ($this->path !== '' && $this->path[0] !== '/') {
            $output .= '/';
        }

        // path, query, fragment
        $output .= $this->buildRelative();

        return $output;
    }
function buildAbsolute ( ) : string { $ output = '' ; if ( $ this -> host === null ) { throw new IncompleteUrlException ( 'No host specified' ) ; } // scheme if ( $ this -> scheme !== null ) { $ output .= $ this -> scheme ; $ output .= '://' ; } else { // protocol-relative $ output .= '//' ; } // host, port $ output .= $ this -> getFullHost ( ) ; // ensure a forward slash between host and a non-empty path if ( $ this -> path !== '' && $ this -> path [ 0 ] !== '/' ) { $ output .= '/' ; } // path, query, fragment $ output .= $ this -> buildRelative ( ) ; return $ output ; }
Build an absolute URL

@throws IncompleteUrlException if no host is specified
Build an absolute URL