code: public function getUrlString(): string
      {
          $query = "";
          if (strlen($this->queryString) > 0) {
              $query = sprintf("?%s", $this->queryString);
          }
          
          if (($this->scheme == 'http' && $this->getPort() == 80) || ($this->scheme == 'ftp' && $this->getPort() == 21) || ($this->scheme == 'https' && $this->getPort() == 443)) {
              return sprintf("%s://%s%s%s", $this->scheme, $this->getAddress(), $this->path, $query);
          }
          return sprintf("%s://%s:%d%s%s", $this->scheme, $this->getAddress(), $this->getPort(), $this->path, $query);
      }
docs: Retrieve the url as string
  
  @return string