public function AbstractMessage::getHeaders

Get all headers as a collection

Parameters

bool $asObjects Set to true to retrieve a collection of Header objects:

Return value

Collection Returns a {@see Collection} of all headers

Overrides MessageInterface::getHeaders

File

drupal/core/vendor/guzzle/http/Guzzle/Http/Message/AbstractMessage.php, line 85

Class

AbstractMessage
Abstract HTTP request/response message

Namespace

Guzzle\Http\Message

Code

public function getHeaders($asObjects = false) {
  if ($asObjects) {
    $result = $this->headers;
  }
  else {
    $result = array();

    // Convert all of the headers into a collection
    foreach ($this->headers as $header) {
      foreach ($header
        ->raw() as $key => $value) {
        $result[$key] = $value;
      }
    }
  }
  return new Collection($result);
}