You are here

public function Message::getHeaders in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/psr-http-message-bridge/Tests/Fixtures/Message.php \Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\Message::getHeaders()

Retrieves all message header values.

The keys represent the header name as it will be sent over the wire, and each value is an array of strings associated with the header.

// Represent the headers as a string foreach ($message->getHeaders() as $name => $values) { echo $name . ": " . implode(", ", $values); }

// Emit headers iteratively: foreach ($message->getHeaders() as $name => $values) { foreach ($values as $value) { header(sprintf('%s: %s', $name, $value), false); } }

While header names are not case-sensitive, getHeaders() will preserve the exact case in which headers were originally specified.

Return value

array Returns an associative array of the message's headers. Each key MUST be a header name, and each value MUST be an array of strings for that header.

Overrides MessageInterface::getHeaders

File

vendor/symfony/psr-http-message-bridge/Tests/Fixtures/Message.php, line 45

Class

Message
Message.

Namespace

Symfony\Bridge\PsrHttpMessage\Tests\Fixtures

Code

public function getHeaders() {
  return $this->headers;
}