messages; } /** * @return string[] */ public function getLastMessage(): array { return count($this->messages) > 0 ? end($this->messages) : []; } /** * Logs with an arbitrary level. * * @param mixed $level * @param string $message * @param array $context * * @return void * * @throws \Psr\Log\InvalidArgumentException */ public function log($level, $message, array $context = array()) { $this->messages[] = [ 'level' => $level, 'message' => $message, 'context' => $context, ]; } }