Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

(no description)

File Size: 246 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Message:: (7 methods):
  toString()
  bodySummary()
  rewindBody()
  parseMessage()
  parseRequestUri()
  parseRequest()
  parseResponse()


Class: Message  - X-Ref

toString(MessageInterface $message)   X-Ref
Returns the string representation of an HTTP message.

param: MessageInterface $message Message to convert to a string.

bodySummary(MessageInterface $message, int $truncateAt = 120)   X-Ref
Get a short summary of the message body.

Will return `null` if the response is not printable.

param: MessageInterface $message    The message to get the body summary
param: int              $truncateAt The maximum allowed size of the summary

rewindBody(MessageInterface $message)   X-Ref
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`.

param: MessageInterface $message Message to rewind

parseMessage(string $message)   X-Ref
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.

param: string $message HTTP request or response to parse.

parseRequestUri(string $path, array $headers)   X-Ref
Constructs a URI for an HTTP request message.

param: string $path    Path from the start-line
param: array  $headers Array of headers (each value an array).

parseRequest(string $message)   X-Ref
Parses a request message string into a request object.

param: string $message Request message string.

parseResponse(string $message)   X-Ref
Parses a response message string into a response object.

param: string $message Response message string.