Skip to content

Commit

Permalink
Merge branch 'dev-context-translator' of github.com:fykosak/nette-fks…
Browse files Browse the repository at this point in the history
…-utils into dev-context-translator
  • Loading branch information
cevro committed Sep 3, 2024
2 parents 654b02b + 73282c1 commit 2f84dd9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 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,13 @@ class Message
public const LVL_INFO = 'info';
public const LVL_PRIMARY = 'primary';

public string $text;
public $text;
public string $level;

public function __construct(string $message, string $level)
/**
* @param string|Html $message
*/
public function __construct($message, string $level)
{
$this->text = $message;
$this->level = $level;
Expand All @@ -31,7 +35,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 2f84dd9

Please sign in to comment.