From b817100d144bb0190ce69115cd016ed2f778d656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Kr=C5=A1ka?= Date: Wed, 7 Feb 2024 20:49:59 +0100 Subject: [PATCH] Message accept Html --- src/Logging/Message.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Logging/Message.php b/src/Logging/Message.php index 8759ce4..2c4f953 100644 --- a/src/Logging/Message.php +++ b/src/Logging/Message.php @@ -5,6 +5,7 @@ namespace Fykosak\Utils\Logging; use Nette\SmartObject; +use Nette\Utils\Html; class Message { @@ -16,10 +17,10 @@ class Message public const LVL_INFO = 'info'; public const LVL_PRIMARY = 'primary'; - public string $text; + public Html|string $text; public string $level; - public function __construct(string $message, string $level) + public function __construct(Html|string $message, string $level) { $this->text = $message; $this->level = $level; @@ -31,7 +32,7 @@ public function __construct(string $message, string $level) public function __toArray(): array { return [ - 'text' => $this->text, + 'text' => ($this->text instanceof Html) ? $this->text->toHtml() : $this->text, 'level' => $this->level, ]; }