From c83369cac8edec1c8a85ba6a627fd0dbfe748823 Mon Sep 17 00:00:00 2001 From: Antonio Almeida Date: Mon, 29 Apr 2024 02:10:48 +0100 Subject: [PATCH] Refactor file extension handling in FileOutput class --- src/Helpers/FileOutput.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Helpers/FileOutput.php b/src/Helpers/FileOutput.php index 0fa945f..2137bbb 100644 --- a/src/Helpers/FileOutput.php +++ b/src/Helpers/FileOutput.php @@ -36,7 +36,7 @@ public function __construct() */ public function write(string $path, array $attributes = [], string $extension = null): void { - $extension ??= (string) Str::afterLast($extension, '.'); + $extension ??= (string) Str::of($path)->afterLast('.'); // map extensions $file = match ($extension) { @@ -53,7 +53,7 @@ public function write(string $path, array $attributes = [], string $extension = return; } - $path = (string) Str::finish($path, '.'.$extension); + $path = (string) Str::of($path)->finish('.'.$extension); echo Blade::render($template, [ 'src' => $this->assetPath($path), 'args' => $this->prepareAttributes($attributes),