class Message implements Serializable, JsonSerializable

Message class.

This class is a representation of a log message which contains API-related information and can easily be serialized.

Methods

__construct(string $api, float|null $duration, RequestInterface $request, ResponseInterface $response = \null, Exception $exception = \null)

Constructor.

static Message
createFromString(string $json)

Creates a new instance of the class from a JSON string.

string
getLogLevel()

No description

string
getApi()

No description

RequestInterface
getRequest()

No description

Exception|null
getException()

No description

float|null
getDuration()

No description

ResponseInterface|null
getResponse()

No description

bool
isError()

True if the requests threw an error.

jsonSerialize()

{@inheritdoc}

serialize()

{@inheritdoc}

unserialize($serialized)

{@inheritdoc}

string
asString()

Returns a string representation of the current message.

string
__toString()

No description

Details

at line 62
__construct(string $api, float|null $duration, RequestInterface $request, ResponseInterface $response = \null, Exception $exception = \null)

Constructor.

Parameters

string $api
float|null $duration
RequestInterface $request
ResponseInterface $response
Exception $exception

at line 90
static Message createFromString(string $json)

Creates a new instance of the class from a JSON string.

Parameters

string $json

Return Value

Message

at line 118
string getLogLevel()

Return Value

string

at line 128
string getApi()

Return Value

string

at line 136
RequestInterface getRequest()

Return Value

RequestInterface

at line 144
Exception|null getException()

Return Value

Exception|null

at line 152
float|null getDuration()

Return Value

float|null

at line 160
ResponseInterface|null getResponse()

Return Value

ResponseInterface|null

at line 170
bool isError()

True if the requests threw an error.

Return Value

bool

at line 192
jsonSerialize()

{@inheritdoc}

at line 200
serialize()

{@inheritdoc}

at line 208
unserialize($serialized)

{@inheritdoc}

Parameters

$serialized

at line 224
string asString()

Returns a string representation of the current message.

Return Value

string

at line 232
string __toString()

Return Value

string