Skip to content

Commit

Permalink
Refactor file extension handling in FileOutput class
Browse files Browse the repository at this point in the history
  • Loading branch information
promatik committed Apr 29, 2024
1 parent ed14dd0 commit c83369c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Helpers/FileOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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),
Expand Down

0 comments on commit c83369c

Please sign in to comment.