Fr3nch13/CakePHP Utilities

ArraySerializer
in package

FinalYes

Serialize or deserialize response messages to/from arrays.

This class provides functionality for serializing a ResponseInterface instance to an array, as well as the reverse operation of creating a Response instance from an array representing a message.

Table of Contents

Methods

fromArray()  : Response
Deserialize a response array to a response instance.
toArray()  : array{status_code: int, reason_phrase: string, protocol_version: string, headers: string[][], body: string}
Serialize a response message to an array.
getValueFromKey()  : mixed

Methods

fromArray()

Deserialize a response array to a response instance.

public static fromArray(array<string|int, mixed> $serializedResponse) : Response
Parameters
$serializedResponse : array<string|int, mixed>
Tags
throws
DeserializationException

When cannot deserialize response.

Return values
Response

toArray()

Serialize a response message to an array.

public static toArray(ResponseInterface $response) : array{status_code: int, reason_phrase: string, protocol_version: string, headers: string[][], body: string}
Parameters
$response : ResponseInterface
Return values
array{status_code: int, reason_phrase: string, protocol_version: string, headers: string[][], body: string}

getValueFromKey()

private static getValueFromKey(array<string|int, mixed> $data, string $key[, string|null $message = null ]) : mixed
Parameters
$data : array<string|int, mixed>
$key : string
$message : string|null = null
Tags
throws
DeserializationException

        
On this page

Search results