interface MessageInterface

Interface MessageInterface

Methods

string|array|null
getHeader(string $name, string|boolean $glue = "\r\n")

Returns a header value.

array
getHeaders()

Returns an array of header lines.

setHeaders(array $headers)

Sets all headers on the current message.

addHeader(string $header)

Adds a header to this message.

addHeaders(array $headers)

Adds a set of headers to this message.

string
getContent()

Returns the content of the message.

setContent(string $content)

Sets the content of the message.

string
__toString()

Returns the message document.

Details

at line 19
string|array|null getHeader(string $name, string|boolean $glue = "\r\n")

Returns a header value.

Parameters

string $name A header name
string|boolean $glue Glue for implode, or false to return an array

Return Value

string|array|null The header value(s)

at line 26
array getHeaders()

Returns an array of header lines.

Return Value

array An array of header lines (integer indexes, e.g. ["Header: value"])

at line 35
setHeaders(array $headers)

Sets all headers on the current message.

Headers can be complete ["Header: value"] pairs or an associative array ["Header" => "value"]

Parameters

array $headers An array of header lines

at line 42
addHeader(string $header)

Adds a header to this message.

Parameters

string $header A header line

at line 51
addHeaders(array $headers)

Adds a set of headers to this message.

Headers can be complete ["Header: value"] pairs or an associative array ["Header" => "value"]

Parameters

array $headers Headers

at line 58
string getContent()

Returns the content of the message.

Return Value

string The message content

at line 65
setContent(string $content)

Sets the content of the message.

Parameters

string $content The message content

at line 72
string __toString()

Returns the message document.

Return Value

string The message