getHeaders() as $name => $values) { * echo $name . ": " . implode(", ", $values); * } * * @return array Returns an associative array of the message's headers. */ public function getHeaders(); /** * Checks if a header exists by the given case-insensitive name. * * @param string $header Case-insensitive header name. * * @return bool Returns true if any header names match the given header * name using a case-insensitive string comparison. Returns false if * no matching header name is found in the message. */ public function hasHeader($header); /** * Retrieve a header by the given case-insensitive name as a string. * * This method returns all of the header values of the given * case-insensitive header name as a string concatenated together using * a comma. * * @param string $header Case-insensitive header name. * * @return string */ public function getHeader($header); /** * Retrieves a header by the given case-insensitive name as an array of strings. * * @param string $header Case-insensitive header name. * * @return string[] */ public function getHeaderAsArray($header); /** * Sets a header, replacing any existing values of any headers with the * same case-insensitive name. * * The header name is case-insensitive. The header values MUST be a string * or an array of strings. * * @param string $header Header name * @param string|string[] $value Header value(s) * * @return void */ public function setHeader($header, $value); /** * Sets headers, replacing any headers that have already been set on the message. * * The array keys MUST be a string. The array values must be either a * string or an array of strings. * * @param array $headers Headers to set. * * @return void */ public function setHeaders(array $headers); /** * Appends a header value for the specified header. * * Existing values for the specified header will be maintained. The new * value will be appended to the existing list. * * @param string $header Header name to add * @param string $value Value of the header * * @return void */ public function addHeader($header, $value); /** * Merges in an associative array of headers. * * Each array key MUST be a string representing the case-insensitive name * of a header. Each value MUST be either a string or an array of strings. * For each value, the value is appended to any existing header of the same * name, or, if a header does not already exist by the given name, then the * header is added. * * @param array $headers Associative array of headers to add to the message * * @return void */ public function addHeaders(array $headers); /** * Remove a specific header by case-insensitive name. * * @param string $header HTTP header to remove * * @return void */ public function removeHeader($header); }