From 8d7b1cbd3ba9acfd4cc41fe7050eef31fe5c1f19 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Wed, 26 Jun 2024 21:00:48 +0200 Subject: [PATCH] Extract helper method to render Html Literally just for matching the code style --- packages/framework/src/Support/Includes.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/framework/src/Support/Includes.php b/packages/framework/src/Support/Includes.php index e2517e927f3..75a039f7b35 100644 --- a/packages/framework/src/Support/Includes.php +++ b/packages/framework/src/Support/Includes.php @@ -69,10 +69,10 @@ public static function html(string $filename, ?string $default = null): ?HtmlStr $path = static::normalizePath($filename, '.html'); if (! Filesystem::exists($path)) { - return $default === null ? null : new HtmlString($default); + return $default === null ? null : static::renderHtml($default); } - return new HtmlString(Filesystem::get($path)); + return static::renderHtml(Filesystem::get($path)); } /** @@ -116,6 +116,11 @@ protected static function normalizePath(string $filename, string $extension): st return static::path(basename($filename, $extension).$extension); } + protected static function renderHtml(string $html): HtmlString + { + return new HtmlString($html); + } + protected static function renderMarkdown(string $markdown): HtmlString { return new HtmlString(trim(Markdown::render($markdown, MarkdownDocument::class)));