Skip to content

Commit

Permalink
refactor(Naming): improve name generation logic
Browse files Browse the repository at this point in the history
- Refactored the name generation logic in the `name` method of the `Naming` trait
- Updated the logic to use the `ucwords` function for better readability
  • Loading branch information
guanguans committed May 8, 2024
1 parent df80937 commit 222dfa9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 65 deletions.
9 changes: 5 additions & 4 deletions src/Collectors/Concerns/Naming.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ trait Naming
{
public static function name(): string
{
return (string) Str::of(class_basename(static::class))
->beforeLast(class_basename(self::class))
->snake(' ')
->ucwords();
return ucwords(
(string) Str::of(class_basename(static::class))
->beforeLast(class_basename(self::class))
->snake(' ')
);
}
}
7 changes: 0 additions & 7 deletions src/ExceptionNotifyServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,18 @@
use Guanguans\LaravelExceptionNotify\Commands\TestCommand;
use Guanguans\LaravelExceptionNotify\Facades\ExceptionNotify;
use Guanguans\LaravelExceptionNotify\Macros\RequestMacro;
use Guanguans\LaravelExceptionNotify\Macros\StringableMacro;
use Guanguans\LaravelExceptionNotify\Macros\StrMacro;
use Illuminate\Container\Container;
use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Contracts\Debug\ExceptionHandler;
use Illuminate\Foundation\Exceptions\Handler;
use Illuminate\Http\Request;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
use Illuminate\Support\Stringable;

class ExceptionNotifyServiceProvider extends ServiceProvider
{
public array $singletons = [
RequestMacro::class => RequestMacro::class,
StringableMacro::class => StringableMacro::class,
StrMacro::class => StrMacro::class,
];

/**
Expand Down Expand Up @@ -87,8 +82,6 @@ private function setupConfig(): self
private function registerMacros(): self
{
Request::mixin($this->app->make(RequestMacro::class));
Str::mixin($this->app->make(StrMacro::class));
Stringable::mixin($this->app->make(StringableMacro::class));

return $this;
}
Expand Down
25 changes: 0 additions & 25 deletions src/Macros/StrMacro.php

This file was deleted.

29 changes: 0 additions & 29 deletions src/Macros/StringableMacro.php

This file was deleted.

0 comments on commit 222dfa9

Please sign in to comment.