Skip to content

Commit 33fbf7e

Browse files
committed
Remove global transformer
1 parent d63c201 commit 33fbf7e

File tree

4 files changed

+20
-47
lines changed

4 files changed

+20
-47
lines changed

config/exception-notify.php

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -68,32 +68,27 @@
6868

6969
/*
7070
|--------------------------------------------------------------------------
71-
| Collector configuration.
71+
| List of collectors.
7272
|--------------------------------------------------------------------------
7373
|
74-
| Responsible for collecting and transforming the exception data.
74+
| Responsible for collecting the exception data.
7575
|
7676
*/
7777
'collector' => [
78-
// List of collectors
79-
'class' => [
80-
\Guanguans\LaravelExceptionNotify\Collectors\LaravelCollector::class,
81-
\Guanguans\LaravelExceptionNotify\Collectors\AnnexCollector::class,
82-
\Guanguans\LaravelExceptionNotify\Collectors\PhpInfoCollector::class,
83-
\Guanguans\LaravelExceptionNotify\Collectors\ExceptionBasicCollector::class,
84-
\Guanguans\LaravelExceptionNotify\Collectors\ExceptionTraceCollector::class,
85-
\Guanguans\LaravelExceptionNotify\Collectors\RequestBasicCollector::class,
86-
\Guanguans\LaravelExceptionNotify\Collectors\RequestHeaderCollector::class,
87-
\Guanguans\LaravelExceptionNotify\Collectors\RequestQueryCollector::class,
88-
\Guanguans\LaravelExceptionNotify\Collectors\RequestPostCollector::class,
89-
\Guanguans\LaravelExceptionNotify\Collectors\RequestFileCollector::class,
90-
// \Guanguans\LaravelExceptionNotify\Collectors\RequestMiddlewareCollector::class,
91-
// \Guanguans\LaravelExceptionNotify\Collectors\RequestServerCollector::class,
92-
// \Guanguans\LaravelExceptionNotify\Collectors\RequestCookieCollector::class,
93-
// \Guanguans\LaravelExceptionNotify\Collectors\RequestSessionCollector::class,
94-
],
95-
// The transformer is used to transformer collectors to reports.
96-
'transformer' => \Guanguans\LaravelExceptionNotify\CollectorTransformer::class,
78+
\Guanguans\LaravelExceptionNotify\Collectors\LaravelCollector::class,
79+
\Guanguans\LaravelExceptionNotify\Collectors\AnnexCollector::class,
80+
\Guanguans\LaravelExceptionNotify\Collectors\PhpInfoCollector::class,
81+
\Guanguans\LaravelExceptionNotify\Collectors\ExceptionBasicCollector::class,
82+
\Guanguans\LaravelExceptionNotify\Collectors\ExceptionTraceCollector::class,
83+
\Guanguans\LaravelExceptionNotify\Collectors\RequestBasicCollector::class,
84+
\Guanguans\LaravelExceptionNotify\Collectors\RequestHeaderCollector::class,
85+
\Guanguans\LaravelExceptionNotify\Collectors\RequestQueryCollector::class,
86+
\Guanguans\LaravelExceptionNotify\Collectors\RequestPostCollector::class,
87+
\Guanguans\LaravelExceptionNotify\Collectors\RequestFileCollector::class,
88+
// \Guanguans\LaravelExceptionNotify\Collectors\RequestMiddlewareCollector::class,
89+
// \Guanguans\LaravelExceptionNotify\Collectors\RequestServerCollector::class,
90+
// \Guanguans\LaravelExceptionNotify\Collectors\RequestCookieCollector::class,
91+
// \Guanguans\LaravelExceptionNotify\Collectors\RequestSessionCollector::class,
9792
],
9893

9994
/*

src/CollectorManager.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ public function __toString()
4949
return $collector;
5050
})
5151
->pipe(function (Collection $collectors): string {
52-
return call(config('exception-notify.collector.transformer'), ['collectors' => $collectors]);
52+
return $collectors->reduce(function (string $carry, Collector $collector) {
53+
return $carry.PHP_EOL.sprintf('%s: %s', $collector->getName(), $collector);
54+
}, '');
5355
});
5456
}
5557
}

src/CollectorTransformer.php

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/ExceptionNotifyServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ protected function setupConfig()
7070
protected function registerCollectorManager()
7171
{
7272
$this->app->singleton(CollectorManager::class, function (Container $app) {
73-
$collectors = collect($app['config']['exception-notify.collector.class'])
73+
$collectors = collect($app['config']['exception-notify.collector'])
7474
->map(function ($parameters, $class) {
7575
if (! is_array($parameters)) {
7676
[$parameters, $class] = [$class, $parameters];

0 commit comments

Comments
 (0)