public function fromString($uri)
    {
        if (is_numeric($uri)) { //Could be a valid url
            $uri = '' . $uri;
        }
        if (!is_string($uri)) {
            $uri = '';
        }
        $this->setRelative();
        if (0 === strpos($uri, '//')) {
            $this->setAbsolute();
        }
        $parsed_url = parse_url($uri);
        if (!$parsed_url) {
            return $this;
        }
        if (array_key_exists('scheme', $parsed_url)) {
            $this->setAbsolute();
        }
        foreach ($parsed_url as $urlPart => $value) {
            $method = 'set' . ucfirst($urlPart);
            if (method_exists($this, $method)) {
                $this->$method($value);
            }
        }
        return $this;
    }
public function fromString($uri)
    {
        if (is_numeric($uri)) { //Could be a valid url
            $uri = '' . $uri;
        }
        if (!is_string($uri)) {
            $uri = '';
        }
        $this->setRelative();
        if (0 === strpos($uri, '//')) {
            $this->setAbsolute();
        }
        $parsed_url = parse_url($uri);
        if (!$parsed_url) {
            return $this;
        }
        if (array_key_exists('scheme', $parsed_url)) {
            $this->setAbsolute();
        }
        foreach ($parsed_url as $urlPart => $value) {
            $method = 'set' . ucfirst($urlPart);
            if (method_exists($this, $method)) {
                $this->$method($value);
            }
        }
        return $this;
    }
public function fromString ( $ uri ) { if ( is_numeric ( $ uri ) ) { //Could be a valid url $ uri = '' . $ uri ; } if ( ! is_string ( $ uri ) ) { $ uri = '' ; } $ this -> setRelative ( ) ; if ( 0 === strpos ( $ uri , '//' ) ) { $ this -> setAbsolute ( ) ; } $ parsed_url = parse_url ( $ uri ) ; if ( ! $ parsed_url ) { return $ this ; } if ( array_key_exists ( 'scheme' , $ parsed_url ) ) { $ this -> setAbsolute ( ) ; } foreach ( $ parsed_url as $ urlPart => $ value ) { $ method = 'set' . ucfirst ( $ urlPart ) ; if ( method_exists ( $ this , $ method ) ) { $ this -> $ method ( $ value ) ; } } return $ this ; }
Hydrate this object with values from a string
@param $uri
@return self
Hydrate this object with values from a string