Skip to content

Commit

Permalink
[PSR-7] Clarify MessageInterface::getHeaders()
Browse files Browse the repository at this point in the history
- Per [the mailing list](https://groups.google.com/d/msg/php-fig/H_NR7qctw-8/9jDffi4_j7cJ), clarified the return value of `getHeaders()` to indicate the structure of the returned array.
  • Loading branch information
weierophinney committed Oct 13, 2014
1 parent 14b51aa commit 4082305
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion proposed/http-message.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,15 @@ interface MessageInterface
* echo $name . ": " . implode(", ", $values);
* }
*
* @return array Returns an associative array of the message's headers.
* // Emit headers iteratively:
* foreach ($message->getHeaders() as $name => $values) {
* foreach ($values as $value) {
* header(sprintf('%s: %s', $name, $value), false);
* }
* }
*
* @return 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.
*/
public function getHeaders();

Expand Down

0 comments on commit 4082305

Please # to comment.