public function addHeader($key, $value = null)
    {
        //if it's an array
        if (is_array($key)) {
            //warning this overwrites existing headers
            $this->headers = $key;
            return $this;
        }

        //if the value is null
        if (is_null($value)) {
            $this->headers[] = $key;
            return $this;
        }

        //else it should be key value
        $this->headers[] = $key . ': ' . $value;
        return $this;
    }
public function addHeader($key, $value = null)
    {
        //if it's an array
        if (is_array($key)) {
            //warning this overwrites existing headers
            $this->headers = $key;
            return $this;
        }

        //if the value is null
        if (is_null($value)) {
            $this->headers[] = $key;
            return $this;
        }

        //else it should be key value
        $this->headers[] = $key . ': ' . $value;
        return $this;
    }
public function addHeader ( $ key , $ value = null ) { //if it's an array if ( is_array ( $ key ) ) { //warning this overwrites existing headers $ this -> headers = $ key ; return $ this ; } //if the value is null if ( is_null ( $ value ) ) { $ this -> headers [ ] = $ key ; return $ this ; } //else it should be key value $ this -> headers [ ] = $ key . ': ' . $ value ; return $ this ; }
Add headers into this request

@param string|array $key
@param string|null  $value

@return Rest
Add headers into this request