function build(): string
    {
        if ($this->host !== null && $this->preferredFormat === static::ABSOLUTE) {
            return $this->buildAbsolute();
        } else {
            return $this->buildRelative();
        }
    }
function build(): string
    {
        if ($this->host !== null && $this->preferredFormat === static::ABSOLUTE) {
            return $this->buildAbsolute();
        } else {
            return $this->buildRelative();
        }
    }
function build ( ) : string { if ( $ this -> host !== null && $ this -> preferredFormat === static :: ABSOLUTE ) { return $ this -> buildAbsolute ( ) ; } else { return $ this -> buildRelative ( ) ; } }
Build an absolute or relative URL

- if no host is specified, a relative URL will be returned
- if the host is specified, an absolute URL will be returned
(unless the preferred format option is set to relative)

@see Url::setPreferredFormat()
Build an absolute or relative URL