Skip to content

Commit 0c9fec5

Browse files
committed
Add VarExportPipeline
1 parent afb82e7 commit 0c9fec5

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

config/exception-notify.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Guanguans\LaravelExceptionNotify\Pipelines\ToHtmlPipeline;
1414
use Guanguans\LaravelExceptionNotify\Pipelines\ToMarkdownPipeline;
1515
use Guanguans\LaravelExceptionNotify\Pipelines\TrimPipeline;
16+
use Guanguans\LaravelExceptionNotify\Pipelines\VarExportPipeline;
1617

1718
return [
1819
/*
@@ -132,6 +133,7 @@
132133
|
133134
*/
134135
'pipeline' => [
136+
VarExportPipeline::class,
135137
TrimPipeline::class,
136138
],
137139

src/Collectors/Collector.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ protected function applyPipeCollect()
4747

4848
public function __toString()
4949
{
50-
return varexport(
51-
$this->applyPipeCollect(),
52-
true
53-
);
50+
return (string) var_export($this->applyPipeCollect(), true);
5451
}
5552
}

src/Pipelines/VarExportPipeline.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
/**
4+
* This file is part of the guanguans/laravel-exception-notify.
5+
*
6+
* (c) guanguans <[email protected]>
7+
*
8+
* This source file is subject to the MIT license that is bundled.
9+
*/
10+
11+
namespace Guanguans\LaravelExceptionNotify\Pipelines;
12+
13+
use Closure;
14+
15+
class VarExportPipeline
16+
{
17+
public function handle(string $report, Closure $next): string
18+
{
19+
return $next(varexport($report, true));
20+
}
21+
}

0 commit comments

Comments
 (0)