Chris@0: getHeaders() as $name => $values) { Chris@0: * echo $name . ": " . implode(", ", $values); Chris@0: * } Chris@0: * Chris@0: * // Emit headers iteratively: Chris@0: * foreach ($message->getHeaders() as $name => $values) { Chris@0: * foreach ($values as $value) { Chris@0: * header(sprintf('%s: %s', $name, $value), false); Chris@0: * } Chris@0: * } Chris@0: * Chris@0: * While header names are not case-sensitive, getHeaders() will preserve the Chris@0: * exact case in which headers were originally specified. Chris@0: * Chris@0: * @return string[][] Returns an associative array of the message's headers. Each Chris@0: * key MUST be a header name, and each value MUST be an array of strings Chris@0: * for that header. Chris@0: */ Chris@0: public function getHeaders(); Chris@0: Chris@0: /** Chris@0: * Checks if a header exists by the given case-insensitive name. Chris@0: * Chris@0: * @param string $name Case-insensitive header field name. Chris@0: * @return bool Returns true if any header names match the given header Chris@0: * name using a case-insensitive string comparison. Returns false if Chris@0: * no matching header name is found in the message. Chris@0: */ Chris@0: public function hasHeader($name); Chris@0: Chris@0: /** Chris@0: * Retrieves a message header value by the given case-insensitive name. Chris@0: * Chris@0: * This method returns an array of all the header values of the given Chris@0: * case-insensitive header name. Chris@0: * Chris@0: * If the header does not appear in the message, this method MUST return an Chris@0: * empty array. Chris@0: * Chris@0: * @param string $name Case-insensitive header field name. Chris@0: * @return string[] An array of string values as provided for the given Chris@0: * header. If the header does not appear in the message, this method MUST Chris@0: * return an empty array. Chris@0: */ Chris@0: public function getHeader($name); Chris@0: Chris@0: /** Chris@0: * Retrieves a comma-separated string of the values for a single header. Chris@0: * Chris@0: * This method returns all of the header values of the given Chris@0: * case-insensitive header name as a string concatenated together using Chris@0: * a comma. Chris@0: * Chris@0: * NOTE: Not all header values may be appropriately represented using Chris@0: * comma concatenation. For such headers, use getHeader() instead Chris@0: * and supply your own delimiter when concatenating. Chris@0: * Chris@0: * If the header does not appear in the message, this method MUST return Chris@0: * an empty string. Chris@0: * Chris@0: * @param string $name Case-insensitive header field name. Chris@0: * @return string A string of values as provided for the given header Chris@0: * concatenated together using a comma. If the header does not appear in Chris@0: * the message, this method MUST return an empty string. Chris@0: */ Chris@0: public function getHeaderLine($name); Chris@0: Chris@0: /** Chris@0: * Return an instance with the provided value replacing the specified header. Chris@0: * Chris@0: * While header names are case-insensitive, the casing of the header will Chris@0: * be preserved by this function, and returned from getHeaders(). Chris@0: * Chris@0: * This method MUST be implemented in such a way as to retain the Chris@0: * immutability of the message, and MUST return an instance that has the Chris@0: * new and/or updated header and value. Chris@0: * Chris@0: * @param string $name Case-insensitive header field name. Chris@0: * @param string|string[] $value Header value(s). Chris@0: * @return static Chris@0: * @throws \InvalidArgumentException for invalid header names or values. Chris@0: */ Chris@0: public function withHeader($name, $value); Chris@0: Chris@0: /** Chris@0: * Return an instance with the specified header appended with the given value. Chris@0: * Chris@0: * Existing values for the specified header will be maintained. The new Chris@0: * value(s) will be appended to the existing list. If the header did not Chris@0: * exist previously, it will be added. Chris@0: * Chris@0: * This method MUST be implemented in such a way as to retain the Chris@0: * immutability of the message, and MUST return an instance that has the Chris@0: * new header and/or value. Chris@0: * Chris@0: * @param string $name Case-insensitive header field name to add. Chris@0: * @param string|string[] $value Header value(s). Chris@0: * @return static Chris@0: * @throws \InvalidArgumentException for invalid header names or values. Chris@0: */ Chris@0: public function withAddedHeader($name, $value); Chris@0: Chris@0: /** Chris@0: * Return an instance without the specified header. Chris@0: * Chris@0: * Header resolution MUST be done without case-sensitivity. Chris@0: * Chris@0: * This method MUST be implemented in such a way as to retain the Chris@0: * immutability of the message, and MUST return an instance that removes Chris@0: * the named header. Chris@0: * Chris@0: * @param string $name Case-insensitive header field name to remove. Chris@0: * @return static Chris@0: */ Chris@0: public function withoutHeader($name); Chris@0: Chris@0: /** Chris@0: * Gets the body of the message. Chris@0: * Chris@0: * @return StreamInterface Returns the body as a stream. Chris@0: */ Chris@0: public function getBody(); Chris@0: Chris@0: /** Chris@0: * Return an instance with the specified message body. Chris@0: * Chris@0: * The body MUST be a StreamInterface object. Chris@0: * Chris@0: * This method MUST be implemented in such a way as to retain the Chris@0: * immutability of the message, and MUST return a new instance that has the Chris@0: * new body stream. Chris@0: * Chris@0: * @param StreamInterface $body Body. Chris@0: * @return static Chris@0: * @throws \InvalidArgumentException When the body is not valid. Chris@0: */ Chris@0: public function withBody(StreamInterface $body); Chris@0: }