public function set(string $field, $value)
    {
        if ($value === null)
            $value = "";

        switch ($field)
        {
            case "scheme":
                $this->scheme = strtolower($value);
                return $this;
            case "port":
                $value = empty($value) ? null : (int)$value;
            case "username":
            case "password":
            case "fragment":
                $this->$field = $value;
                return $this;
            case "query":
                $this->query = $this->parseQuery($value);
                return $this;
            case "path":
                $this->setPath($value);
                return $this;
            case "host":
                return $this->setHost($value);
        }
        throw new \OutOfRangeException($field);
    }
public function set(string $field, $value)
    {
        if ($value === null)
            $value = "";

        switch ($field)
        {
            case "scheme":
                $this->scheme = strtolower($value);
                return $this;
            case "port":
                $value = empty($value) ? null : (int)$value;
            case "username":
            case "password":
            case "fragment":
                $this->$field = $value;
                return $this;
            case "query":
                $this->query = $this->parseQuery($value);
                return $this;
            case "path":
                $this->setPath($value);
                return $this;
            case "host":
                return $this->setHost($value);
        }
        throw new \OutOfRangeException($field);
    }
public function set ( string $ field , $ value ) { if ( $ value === null ) $ value = "" ; switch ( $ field ) { case "scheme" : $ this -> scheme = strtolower ( $ value ) ; return $ this ; case "port" : $ value = empty ( $ value ) ? null : ( int ) $ value ; case "username" : case "password" : case "fragment" : $ this -> $ field = $ value ; return $ this ; case "query" : $ this -> query = $ this -> parseQuery ( $ value ) ; return $ this ; case "path" : $ this -> setPath ( $ value ) ; return $ this ; case "host" : return $ this -> setHost ( $ value ) ; } throw new \ OutOfRangeException ( $ field ) ; }
Set a field to a new value
@param string $field The field to set
@param mixed $value The value to update
@return URL Provides fluent interface
Set a field to a new value