abstract class AbstractMessage implements MessageInterface

Class AbstractMessage

Methods

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

Returns the value of a header.

array
getHeaderAttributes(string $name)

Returns a header's attributes.

string|null
getHeaderAttribute(string $header, string $attribute)

Returns the value of a particular header attribute.

toDomDocument()

Returns the current message as a DOMDocument.

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.

array
getHeaders()

Returns an array of header lines.

setContent(string $content)

Sets the content of the message.

string
getContent()

Returns the content of the message.

string
__toString()

Returns the message document.

flattenHeaders(array $headers)

No description

Details

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

Returns the value of a header.

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 47
array getHeaderAttributes(string $name)

Returns a header's attributes.

Parameters

string $name A header name

Return Value

array An associative array of attributes

at line 74
string|null getHeaderAttribute(string $header, string $attribute)

Returns the value of a particular header attribute.

Parameters

string $header A header name
string $attribute An attribute name

Return Value

string|null The value of the attribute or null if it isn't set

at line 88
DOMDocument toDomDocument()

Returns the current message as a DOMDocument.

Return Value

DOMDocument

at line 104
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 109
addHeader(string $header)

Adds a header to this message.

Parameters

string $header A header line

at line 114
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 119
array getHeaders()

Returns an array of header lines.

Return Value

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

at line 124
setContent(string $content)

Sets the content of the message.

Parameters

string $content The message content

at line 129
string getContent()

Returns the content of the message.

Return Value

string The message content

at line 134
string __toString()

Returns the message document.

Return Value

string The message

at line 145
protected flattenHeaders(array $headers)

Parameters

array $headers