Class Message
Methods Summary
-
static
toString ( Psr\Http\Message\MessageInterface $message )
Returns the string representation of an HTTP message.
-
static
bodySummary ( Psr\Http\Message\MessageInterface $message, int $truncateAt = 120 )
Get a short summary of the message body.
-
static
rewindBody ( Psr\Http\Message\MessageInterface $message )
Attempts to rewind a message body and throws an exception on failure.
-
static
parseMessage ( string $message )
Parses an HTTP message into an associative array.
-
static
parseRequestUri ( string $path, array $headers )
Constructs a URI for an HTTP request message.
-
static
parseRequest ( string $message )
Parses a request message string into a request object.
-
static
parseResponse ( string $message )
Parses a response message string into a response object.
Methods Details
static
string
toString (
Psr\Http\Message\MessageInterface
$message
)
Returns the string representation of an HTTP message.
Parameters
Psr\Http\Message\MessageInterface |
$message | Message to convert to a string. |
Returns
string |
static
string|null
bodySummary (
Psr\Http\Message\MessageInterface
$message,
integer
$truncateAt = 120
)
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 |
integer | $truncateAt = 120 | The maximum allowed size of the summary |
Returns
string|null |
static
rewindBody (
Psr\Http\Message\MessageInterface
$message
)
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 |
Exceptions
RuntimeException |
static array parseMessage ( string $message )
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 |
static string parseRequestUri ( string $path, array $headers )
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 |
static
GuzzleHttp\Psr7\Request
parseRequest (
string
$message
)
Parses a request message string into a request object.
Parameters
string | $message | Request message string. |
Returns
GuzzleHttp\Psr7\Request |
static
GuzzleHttp\Psr7\Response
parseResponse (
string
$message
)
Parses a response message string into a response object.
Parameters
string | $message | Response message string. |
Returns
GuzzleHttp\Psr7\Response |