\Zend\Diactoros\ResponseArraySerializer

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.

Summary

Methods
Properties
Constants
toArray()
fromArray()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
getValueFromKey()
No private properties found
N/A

Methods

toArray()

toArray(\Psr\Http\Message\ResponseInterface  $response) : array

Serialize a response message to an array.

Parameters

\Psr\Http\Message\ResponseInterface $response

Returns

array

fromArray()

fromArray(array  $serializedResponse) : \Zend\Diactoros\Response

Deserialize a response array to a response instance.

Parameters

array $serializedResponse

Throws

\UnexpectedValueException

when cannot deserialize response

Returns

\Zend\Diactoros\Response

getValueFromKey()

getValueFromKey(array  $data, string  $key, string  $message = null) : mixed

Parameters

array $data
string $key
string $message

Throws

\UnexpectedValueException

Returns

mixed