Exemple #1
0
 /**
  * This method updates the current URL with the given string.
  *
  * @param string $url
  * @return Customweb_Core_Url
  */
 public function updateUrl($urlString)
 {
     $url = new Customweb_Core_Url($urlString);
     // some fields shuld only be updated, in case it is a full qualified URL
     if (strstr($urlString, '://')) {
         if ($url->getHost() !== NULL) {
             $this->setHost($url->getHost());
         }
         if ($url->getPort() !== NULL) {
             $this->setPort($url->getPort());
         }
         if ($url->getPass() !== NULL) {
             $this->setPass($url->getPass());
         }
         if ($url->getScheme() !== NULL) {
             $this->setScheme($url->getScheme());
         }
         if ($url->getUser() !== NULL) {
             $this->setUser($url->getUser());
         }
     }
     if ($url->getFragment() !== NULL) {
         $this->setFragment($url->getFragment());
     }
     if ($url->getPath() !== NULL) {
         $this->setPath($url->getPath());
     }
     if ($url->getQuery() !== NULL) {
         $this->setQuery($url->getQuery());
     }
     return $this;
 }