public function addHeader($name, $value, $append = false)
    {
        // normalize header names in case of 'Content-type' into 'Content-Type'
        $name = str_replace(' ', '-', ucwords(str_replace('-', ' ', $name)));

        // check if we've a Set-Cookie header to process
        if ($this->hasHeader($name) && $append === true) {
            // then check if we've already one cookie header available
            if (is_array($headerValue = $this->getHeader($name))) {
                $headerValue[] = $value;
            } else {
                $headerValue = array($headerValue, $value);
            }

            // if no cookie header simple add it
            $this->headers[$name] = $headerValue;

        } else {
            $this->headers[$name] = $value;
        }
    }
public function addHeader($name, $value, $append = false)
    {
        // normalize header names in case of 'Content-type' into 'Content-Type'
        $name = str_replace(' ', '-', ucwords(str_replace('-', ' ', $name)));

        // check if we've a Set-Cookie header to process
        if ($this->hasHeader($name) && $append === true) {
            // then check if we've already one cookie header available
            if (is_array($headerValue = $this->getHeader($name))) {
                $headerValue[] = $value;
            } else {
                $headerValue = array($headerValue, $value);
            }

            // if no cookie header simple add it
            $this->headers[$name] = $headerValue;

        } else {
            $this->headers[$name] = $value;
        }
    }
public function addHeader ( $ name , $ value , $ append = false ) { // normalize header names in case of 'Content-type' into 'Content-Type' $ name = str_replace ( ' ' , '-' , ucwords ( str_replace ( '-' , ' ' , $ name ) ) ) ; // check if we've a Set-Cookie header to process if ( $ this -> hasHeader ( $ name ) && $ append === true ) { // then check if we've already one cookie header available if ( is_array ( $ headerValue = $ this -> getHeader ( $ name ) ) ) { $ headerValue [ ] = $ value ; } else { $ headerValue = array ( $ headerValue , $ value ) ; } // if no cookie header simple add it $ this -> headers [ $ name ] = $ headerValue ; } else { $ this -> headers [ $ name ] = $ value ; } }
Adds a header information got from connection. We've to take care that headers
like Set-Cookie header can exist multiple times. To support this create an
array that keeps the multiple header values.

@param string  $name   The header name
@param string  $value  The headers value
@param boolean $append If TRUE and a header with the passed name already exists, the value will be appended

@return void
Adds a header information got from connection . We ve to take care that headers like Set - Cookie header can exist multiple times . To support this create an array that keeps the multiple header values .