\GuzzleHttp\Psr7Message

Summary

Methods
Properties
Constants
toString()
bodySummary()
rewindBody()
parseMessage()
parseRequestUri()
parseRequest()
parseResponse()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

toString()

toString(\Psr\Http\Message\MessageInterface  $message) : string

Returns the string representation of an HTTP message.

Parameters

\Psr\Http\Message\MessageInterface $message

Message to convert to a string.

Returns

string —

bodySummary()

bodySummary(\Psr\Http\Message\MessageInterface  $message, int  $truncateAt = 120) : string|null

Get a short summary of the message body.

Will return null if the response is not printable.

Parameters

\Psr\Http\Message\MessageInterface $message

The message to get the body summary

int $truncateAt

The maximum allowed size of the summary

Returns

string|null —

rewindBody()

rewindBody(\Psr\Http\Message\MessageInterface  $message) : mixed

Attempts to rewind a message body and throws an exception on failure.

The body of the message will only be rewound if a call to tell() returns a value other than 0.

Parameters

\Psr\Http\Message\MessageInterface $message

Message to rewind

Throws

\RuntimeException

Returns

mixed —

parseMessage()

parseMessage(string  $message) : array

Parses an HTTP message into an associative array.

The array contains the "start-line" key containing the start line of the message, "headers" key containing an associative array of header array values, and a "body" key containing the body of the message.

Parameters

string $message

HTTP request or response to parse.

Returns

array —

parseRequestUri()

parseRequestUri(string  $path, array  $headers) : string

Constructs a URI for an HTTP request message.

Parameters

string $path

Path from the start-line

array $headers

Array of headers (each value an array).

Returns

string —

parseRequest()

parseRequest(string  $message) : \GuzzleHttp\Psr7\Request

Parses a request message string into a request object.

Parameters

string $message

Request message string.

Returns

\GuzzleHttp\Psr7\Request —

parseResponse()

parseResponse(string  $message) : \GuzzleHttp\Psr7\Response

Parses a response message string into a response object.

Parameters

string $message

Response message string.

Returns

\GuzzleHttp\Psr7\Response —