Skip to content

Commit

Permalink
Message accept Html
Browse files Browse the repository at this point in the history
  • Loading branch information
Headary committed Feb 7, 2024
1 parent 8f3e43a commit b817100
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Logging/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Fykosak\Utils\Logging;

use Nette\SmartObject;
use Nette\Utils\Html;

class Message
{
Expand All @@ -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;
Expand All @@ -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,
];
}
Expand Down

0 comments on commit b817100

Please sign in to comment.