Transform the given set of headers

@param HeaderBag $headers
@return void
329041
public function modify(HeaderBag &$headers)
    {
        foreach ($headers->getByName('set-cookie') as $cookieHeader)
        {
            $cookieName = $cookieHeader->getFirstAttributeName();

            if ( ! $cookieHeader->hasAttribute($this->field) and $this->isCandidateCookie($cookieName))
            {
                $cookieHeader->setAttribute($this->field, $this->value);
            }
        }
    }
1121484
protected function addHeaders(array $headers)
    {
        foreach ($headers as $key => $val) {
            $normalized = strtolower($key);
            $this->headers[$key] = (array)$val;
            $this->headerNames[$normalized] = $key;
        }
    }
1183336
protected function setResponseHeaders(array $headers)
    {
        // reset headers
        $this->headers = [];

        // set response status header
        $this->headers[] = 'HTTP/1.1 ' . $this->getStatusCode() . ' ' . $this->getStatusText();

        // set content type header
        $this->headers['Content-Type'] = 'application/json';

        // set user supplied headers
        foreach ($headers as $key => $value) {
            $this->headers[$key] = $value;
        }
    }
270851
public function headers($headers = null)
    {
        if (!func_num_args()) {
            return $this->_headers;
        }
        $this->_headers = $headers;
        return $this;
    }
57089
protected function unsetHeaders(Array $headers = []) {
    foreach ($headers as $property) {
      $this->client->unsetHeader($property);
    }
  }
232523
public function addDefaultHeaders($headers)
    {
        foreach ($headers as $name => $value) {
            $this->addDefaultHeader($name, $value);
        }

        return $this;
    }
477094
public function merge($headers) {

        foreach ($headers as $key => $value) {
            $this->set($key, $value);
        }

        return $this;

    }
1339310
protected function setHeaders($headers)
    {
        foreach ($headers as $name => $value) {

            //~ Convert to array
            if (!is_array($value)) {
                $value = [$value];
            }

            //~ Clean values
            foreach ($value as $key => $val) {
                $value[$key] = trim($val);
            }

            $this->headersOriginal[$name]     = $value;
            $this->headers[strtolower($name)] = $value;
        }

        return $this;
    }
1353186
private function normalizeHeaders(array $headers)
    {
        $ignoreHeaders = $this->ignoreHeaders;

        foreach ($ignoreHeaders as $ignoreHeader) {
            $headers = array_filter($headers, function($header) use ($ignoreHeader) {
                return stripos($header, $ignoreHeader.':') !== 0;
            });
        }

        return $headers;
    }
1020802
public function setHeaders($headers) 
    {

       if(!$this->_parserObj) {
           $this->initParser($this->getRespondType());

        }

        /** @var array  _headers */
        $this->_headers = $this->getParser()->getHeaders();
        $this->_headers = array_merge($this->_headers,$headers);
    }
10015
public function setHeaders(array $headers = [])
    {

        $this->headers = ($headers instanceof Headers) ? $headers : new Headers((array)$headers);

        return $this;

    }
1098718
private function setRequestHeaders($headers = array()) {
        foreach ($this->headers as $key => $value) {
            $headers[] = $key . ': ' . $value;
        }
        curl_setopt($this->request, CURLOPT_HTTPHEADER, $headers);
    }
700222
public function withHeaders($headers)
    {
        if ($headers instanceof HeaderBag) {
            $headers = $headers->all();
        }

        foreach ($headers as $key => $value) {
            $this->headers->set($key, $value);
        }

        return $this;
    }
494563
protected function setHeaders(array $headers)
    {
        // Ensure this is an atomic operation, either all headers are set or none.
        $before = $this->headers;

        try {
            foreach ($headers as $name => $value) {
                $this->setHeader($name, $value);
            }
        } catch (\Throwable $e) {
            $this->headers = $before;

            throw $e;
        }
    }
353982
public function header(array $headers) {

        $formattedHeaders = [];

        $combinedHeaders = array_change_key_case(array_merge($this->header, $headers));

        foreach ($combinedHeaders as $key => $val)

            $formattedHeaders[] = trim(strtolower($key)) . ':' . $val;

        $this->header = $formattedHeaders;

        return $this;

    }
738267
public function sendHeaders(HeaderBag $headers)
    {
        # First, remove all headers on the response object
        $headersToRemove = $this->response->getHeaders();
        foreach ($headersToRemove as $name => $headerLines)
        {
            $this->response = $this->response->withoutHeader($name);
        }

        # And then, reset all headers from the HeaderBag instance
        foreach ($headers->get() as $header)
        {
            $this->response = $this->response->withAddedHeader(
                $header->getName(),
                $header->getValue()
            );
        }
    }
351588
private static function prepareHeaders(HeaderBag $headerBag)
    {
        $headers = $headerBag->all();
        $result = [];

        foreach ($headers as $header => $values) {
            $result[$header] = $values[0];
        }

        return $result;
    }