Fr3nch13/CakePHP Utilities

AbstractSerializer
in package

AbstractYes

Provides base functionality for request and response de/serialization strategies, including functionality for retrieving a line at a time from the message, splitting headers from the body, and serializing headers.

Table of Contents

Constants

CR  = "\r"
EOL  = "\r\n"
LF  = "\n"

Methods

filterHeader()  : string
Filter a header name to wordcase
getLine()  : string
Retrieve a single line from the stream.
serializeHeaders()  : string
Serialize headers to string values.
splitStream()  : array<string|int, mixed>
Split the stream into headers and body content.

Constants

Methods

filterHeader()

Filter a header name to wordcase

protected static filterHeader(string $header) : string
Parameters
$header : string
Return values
string

getLine()

Retrieve a single line from the stream.

protected static getLine(StreamInterface $stream) : string

Retrieves a line from the stream; a line is defined as a sequence of characters ending in a CRLF sequence.

Parameters
$stream : StreamInterface
Tags
throws
DeserializationException

If the sequence contains a CR or LF in isolation, or ends in a CR.

Return values
string

serializeHeaders()

Serialize headers to string values.

protected static serializeHeaders(array<string|int, mixed> $headers) : string
Parameters
$headers : array<string|int, mixed>
Tags
psalm-param

array<string, string[]> $headers

Return values
string

splitStream()

Split the stream into headers and body content.

protected static splitStream(StreamInterface $stream) : array<string|int, mixed>

Returns an array containing two elements

  • The first is an array of headers
  • The second is a StreamInterface containing the body content
Parameters
$stream : StreamInterface
Tags
throws
DeserializationException

For invalid headers.

Return values
array<string|int, mixed>

        
On this page

Search results