Skip to content

Commit 425887d

Browse files
committed
fix(ExceptionNotifyServiceProvider): simplify command metadata retrieval
- Remove unused Arr import - Revise AboutCommand to directly include homepage URL - Streamline the logic for fetching package version using InstalledVersions - Ensure compatibility with installed versions while improving readability
1 parent 2bd8768 commit 425887d

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

src/ExceptionNotifyServiceProvider.php

+5-14
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Guanguans\LaravelExceptionNotify\Facades\ExceptionNotify;
1919
use Illuminate\Contracts\Debug\ExceptionHandler;
2020
use Illuminate\Foundation\Console\AboutCommand;
21-
use Illuminate\Support\Arr;
2221
use Illuminate\Support\Collection;
2322
use Illuminate\Support\ServiceProvider;
2423
use Illuminate\Support\Stringable;
@@ -117,22 +116,14 @@ private function addSectionToAboutCommand(): void
117116
{
118117
AboutCommand::add(
119118
str($package = 'guanguans/laravel-exception-notify')->headline()->toString(),
120-
static fn (): array => collect()
119+
static fn (): array => collect(['Homepage' => "https://github.com/$package"])
121120
->when(
122121
class_exists(InstalledVersions::class),
123-
static fn (Collection $data): Collection => $data
124-
->replace(Arr::get(InstalledVersions::getAllRawData(), "0.versions.$package", []))
125-
->only([
126-
'pretty_version',
127-
'version',
128-
])
122+
static fn (Collection $data): Collection => $data->put(
123+
'Version',
124+
InstalledVersions::getPrettyVersion($package)
125+
)
129126
)
130-
->replace([
131-
'homepage' => "https://github.com/$package",
132-
])
133-
->mapWithKeys(static fn (string $value, string $key): array => [
134-
str($key)->headline()->toString() => $value,
135-
])
136127
->all()
137128
);
138129
}

0 commit comments

Comments
 (0)