Skip to content

Commit 02a4811

Browse files
committed
refactor
1 parent 5dcc64a commit 02a4811

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/Services/Handler.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
namespace LaravelEnso\Logs\Services;
44

55
use Carbon\Carbon;
6-
use Illuminate\Support\Collection;
76
use Illuminate\Support\Facades\File;
8-
use Illuminate\Support\Str;
97
use LaravelEnso\Helpers\Services\Decimals;
108

119
abstract class Handler
@@ -15,11 +13,11 @@ abstract class Handler
1513
protected function log($file): array
1614
{
1715
$size = $this->formattedSize(File::size($file));
18-
$name = Str::afterLast($file, DIRECTORY_SEPARATOR);
19-
$extension = Str::afterLast($name, '.');
16+
$name = File::name($file);
17+
$extension = File::extension($file);
2018

2119
return [
22-
'name' => Collection::wrap(explode(DIRECTORY_SEPARATOR, $file))->last(),
20+
'name' => "{$name}.{$extension}",
2321
'size' => $size,
2422
'visible' => $size <= self::LogSizeLimit && $extension === 'log',
2523
'modified' => Carbon::createFromTimestamp(File::lastModified($file)),

0 commit comments

Comments
 (0)