class MessageCollector (View source)

Message Collector

Constants

LOGLEVEL_MAPPING

Properties

protected SplObjectStorage $messages
protected LoggerInterface $logger

Methods

void
injectLogger(LoggerInterface $logger)

Injects the (system) logger based on PSR-3.

__construct()

Message Collector Constructor

void
append(string $message, string $severity = Error::SEVERITY_ERROR, int|null $code = null)

No description

bool
hasMessages()

No description

void
flush(callable $callback = null)

No description

void
__destruct()

Flush all notification during the object lifecycle

Details

void injectLogger(LoggerInterface $logger)

Injects the (system) logger based on PSR-3.

Parameters

LoggerInterface $logger

Return Value

void

__construct()

Message Collector Constructor

void append(string $message, string $severity = Error::SEVERITY_ERROR, int|null $code = null)

No description

Parameters

string $message

The message to log

string $severity

An integer value, one of the Error::SEVERITY_* constants

int|null $code

A unique error code

Return Value

void

Exceptions

Exception

bool hasMessages()

No description

Return Value

bool

void flush(callable $callback = null)

No description

Parameters

callable $callback

a callback function to process every notification

Return Value

void

void __destruct()

Flush all notification during the object lifecycle

Return Value

void