public function getMessages(): array
    {
        $messages = $this->messages;

        // sort messages by their timestamp
        \usort($messages, static function ($a, $b) {
            if ($a['time'] === $b['time']) {
                return 0;
            }

            return $a['time'] < $b['time'] ? -1 : 1;
        });

        return $messages;
    }