MessageInterface
in
Expected behavior of an HTTP request
Table of Contents
- appendBody() : $this
- Appends data to the body of the current message.
- appendHeader() : $this
- Adds an additional header value to any headers that accept multiple values (i.e. are an array or implement ArrayAccess)
- header() : array<string|int, mixed>|Header|null
- Returns a single Header object. If multiple headers with the same name exist, then will return an array of header objects.
- headers() : array<string, Header>
- Returns an array containing all Headers.
- populateHeaders() : void
- Populates the $headers array with any headers the getServer knows about.
- prependHeader() : $this
- Adds an additional header value to any headers that accept multiple values (i.e. are an array or implement ArrayAccess)
- removeHeader() : $this
- Removes a header from the list of headers we track.
- setBody() : $this
- Sets the body of the current message.
- setHeader() : $this
- Sets a header and it's value.
- setProtocolVersion() : $this
- Sets the HTTP protocol version.
Methods
appendBody()
Appends data to the body of the current message.
public
appendBody(mixed $data) : $this
Parameters
- $data : mixed
Return values
$this —appendHeader()
Adds an additional header value to any headers that accept multiple values (i.e. are an array or implement ArrayAccess)
public
appendHeader(string $name, string|null $value) : $this
Parameters
- $name : string
- $value : string|null
Return values
$this —header()
Returns a single Header object. If multiple headers with the same name exist, then will return an array of header objects.
public
header(string $name) : array<string|int, mixed>|Header|null
Parameters
- $name : string
Return values
array<string|int, mixed>|Header|null —headers()
Returns an array containing all Headers.
public
headers() : array<string, Header>
Return values
array<string, Header> —An array of the Header objects
populateHeaders()
Populates the $headers array with any headers the getServer knows about.
public
populateHeaders() : void
Return values
void —prependHeader()
Adds an additional header value to any headers that accept multiple values (i.e. are an array or implement ArrayAccess)
public
prependHeader(string $name, string $value) : $this
Parameters
- $name : string
- $value : string
Return values
$this —removeHeader()
Removes a header from the list of headers we track.
public
removeHeader(string $name) : $this
Parameters
- $name : string
Return values
$this —setBody()
Sets the body of the current message.
public
setBody(mixed $data) : $this
Parameters
- $data : mixed
Return values
$this —setHeader()
Sets a header and it's value.
public
setHeader(string $name, array<string|int, mixed>|null|string $value) : $this
Parameters
- $name : string
- $value : array<string|int, mixed>|null|string
Return values
$this —setProtocolVersion()
Sets the HTTP protocol version.
public
setProtocolVersion(string $version) : $this
Parameters
- $version : string