Skip to content

Commit 60572d5

Browse files
committed
Optimize get collector name
1 parent 264927c commit 60572d5

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

config/exception-notify.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
'reporting' => [
108108
// \Guanguans\LaravelExceptionNotify\Listeners\Reporting\LogReportListener::class,
109109
// \Guanguans\LaravelExceptionNotify\Listeners\Reporting\DumpReportListener::class,
110-
\Guanguans\LaravelExceptionNotify\Listeners\Reporting\DdReportListener::class,
110+
// \Guanguans\LaravelExceptionNotify\Listeners\Reporting\DdReportListener::class,
111111
],
112112

113113
/*

src/Collectors/Collector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(callable $pipe = null)
2828

2929
public function getName(): string
3030
{
31-
return Str::ucfirst(Str::beforeLast(class_basename($this), 'Collector'));
31+
return Str::ucwords(Str::snake(Str::beforeLast(class_basename($this), 'Collector'), ' '));
3232
}
3333

3434
protected function applyPipeCollect()

src/Support/Macros/StrMacro.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,11 @@ public static function lcfirst(): callable
3535
return lcfirst($string);
3636
};
3737
}
38+
39+
public static function ucwords(): callable
40+
{
41+
return function ($string) {
42+
return ucwords($string);
43+
};
44+
}
3845
}

0 commit comments

Comments
 (0)