MessageUtil
in package
FinalYes
Table of Contents
Methods
- decodeJSON() : mixed
- decodeXML() : mixed
- decompress() : string
- Decompresses the message content according to the Content-Encoding header and returns the decompressed data
- getContents() : string
- Read the message body's content, throws if the content could not be read from the message body
- getCookiesFromHeader() : array<string, string>|null
- Attempts to extract and parse a cookie from a "Cookie" (user-agent) header
- setContentLengthHeader() : MessageInterface|RequestInterface|ResponseInterface|ServerRequestInterface
- Sets a Content-Length header in the given message in case it does not exist and body size is not null
- setContentTypeHeader() : MessageInterface|RequestInterface|ResponseInterface|ServerRequestInterface
- Tries to determine the content type from the given values and sets the Content-Type header accordingly, throws if no mime type could be guessed.
- setCookie() : ResponseInterface
- Adds a Set-Cookie header to a ResponseInterface (convenience)
- toJSON() : string
- Returns a JSON representation of an HTTP message.
- toString() : string
- Returns the string representation of an HTTP message. (from Guzzle)
- call_decompress_func() : string
Methods
decodeJSON()
public
static decodeJSON(MessageInterface $message[, bool|null $assoc = null ]) : mixed
Parameters
- $message : MessageInterface
- $assoc : bool|null = null
Tags
decodeXML()
public
static decodeXML(MessageInterface $message[, bool|null $assoc = null ]) : mixed
Parameters
- $message : MessageInterface
- $assoc : bool|null = null
decompress()
Decompresses the message content according to the Content-Encoding header and returns the decompressed data
public
static decompress(MessageInterface $message) : string
Parameters
- $message : MessageInterface
Tags
Return values
stringgetContents()
Read the message body's content, throws if the content could not be read from the message body
public
static getContents(MessageInterface $message) : string
Parameters
- $message : MessageInterface
Tags
Return values
stringgetCookiesFromHeader()
Attempts to extract and parse a cookie from a "Cookie" (user-agent) header
public
static getCookiesFromHeader(MessageInterface $message) : array<string, string>|null
Parameters
- $message : MessageInterface
Tags
Return values
array<string, string>|nullsetContentLengthHeader()
Sets a Content-Length header in the given message in case it does not exist and body size is not null
public
static setContentLengthHeader(MessageInterface $message) : MessageInterface|RequestInterface|ResponseInterface|ServerRequestInterface
Parameters
- $message : MessageInterface
Return values
MessageInterface|RequestInterface|ResponseInterface|ServerRequestInterfacesetContentTypeHeader()
Tries to determine the content type from the given values and sets the Content-Type header accordingly, throws if no mime type could be guessed.
public
static setContentTypeHeader(MessageInterface $message[, string|null $filename = null ][, string|null $extension = null ]) : MessageInterface|RequestInterface|ResponseInterface|ServerRequestInterface
Parameters
- $message : MessageInterface
- $filename : string|null = null
- $extension : string|null = null
Tags
Return values
MessageInterface|RequestInterface|ResponseInterface|ServerRequestInterfacesetCookie()
Adds a Set-Cookie header to a ResponseInterface (convenience)
public
static setCookie(ResponseInterface $message, string $name[, string|null $value = null ][, DateTimeInterface|DateInterval|int|null $expiry = null ][, string|null $domain = null ][, string|null $path = null ][, bool $secure = false ][, bool $httpOnly = false ][, string|null $sameSite = null ]) : ResponseInterface
Parameters
- $message : ResponseInterface
- $name : string
- $value : string|null = null
- $expiry : DateTimeInterface|DateInterval|int|null = null
- $domain : string|null = null
- $path : string|null = null
- $secure : bool = false
- $httpOnly : bool = false
- $sameSite : string|null = null
Tags
Return values
ResponseInterfacetoJSON()
Returns a JSON representation of an HTTP message.
public
static toJSON(MessageInterface $message[, bool|null $appendBody = null ]) : string
Parameters
- $message : MessageInterface
- $appendBody : bool|null = null
Return values
stringtoString()
Returns the string representation of an HTTP message. (from Guzzle)
public
static toString(MessageInterface $message[, bool|null $appendBody = null ]) : string
Parameters
- $message : MessageInterface
- $appendBody : bool|null = null
Return values
stringcall_decompress_func()
protected
static call_decompress_func(string $func, string $data) : string
Parameters
- $func : string
- $data : string