function str in Auth0 Single Sign On 8.2
Returns the string representation of an HTTP message.
Parameters
MessageInterface $message Message to convert to a string.:
Return value
string
File
- vendor/
guzzlehttp/ psr7/ src/ functions.php, line 18
Namespace
GuzzleHttp\Psr7Code
function str(MessageInterface $message) {
if ($message instanceof RequestInterface) {
$msg = trim($message
->getMethod() . ' ' . $message
->getRequestTarget()) . ' HTTP/' . $message
->getProtocolVersion();
if (!$message
->hasHeader('host')) {
$msg .= "\r\nHost: " . $message
->getUri()
->getHost();
}
}
elseif ($message instanceof ResponseInterface) {
$msg = 'HTTP/' . $message
->getProtocolVersion() . ' ' . $message
->getStatusCode() . ' ' . $message
->getReasonPhrase();
}
else {
throw new \InvalidArgumentException('Unknown message type');
}
foreach ($message
->getHeaders() as $name => $values) {
$msg .= "\r\n{$name}: " . implode(', ', $values);
}
return "{$msg}\r\n\r\n" . $message
->getBody();
}