Exemplo n.º 1
0
 /**
  * Returns this full URL as a string.
  * 
  * 
  * @throws \Exception                    //if this URL is not valid
  *
  * @return string
  */
 public function getUrl()
 {
     $url_string = $this->getScheme();
     $url_string .= '://';
     if ($this->hasLogin()) {
         $url_string .= $this->getLogin() . '@';
     }
     $url_string .= $this->getHostPort();
     $url_string .= $this->getPath();
     if ($this->hasParameters()) {
         $url_string .= \Altumo\String\String::generateUrlParameterString($this->getParameters());
     }
     if ($this->hasAnchor()) {
         $url_string .= '#' . urlencode($this->getAnchor());
     }
     $this->setFullUrl($url_string);
     if (!$this->isValid()) {
         throw new \Exception('This URL is invalid.');
     }
     return $url_string;
 }