File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,11 @@ public function withShift(int $shift): self;
43
43
*/
44
44
public function process (WriterInterface $ writer ): void ;
45
45
46
+ /**
47
+ * Export the dump as a string.
48
+ */
49
+ public function export (): string ;
50
+
46
51
/**
47
52
* Provides access to the dump variables.
48
53
* @return array<mixed>
Original file line number Diff line number Diff line change 17
17
use Chevere \VarDump \Interfaces \OutputInterface ;
18
18
use Chevere \VarDump \Interfaces \VarDumpInterface ;
19
19
use Chevere \Writer \Interfaces \WriterInterface ;
20
+ use Chevere \Writer \StreamWriter ;
21
+ use function Chevere \Writer \streamTemp ;
20
22
21
23
final class VarDump implements VarDumpInterface
22
24
{
@@ -68,6 +70,15 @@ public function process(WriterInterface $writer): void
68
70
->process ($ this ->output , ...$ this ->variables );
69
71
}
70
72
73
+ public function export (): string
74
+ {
75
+ $ temp = streamTemp ();
76
+ $ tempWriter = new StreamWriter ($ temp );
77
+ $ this ->process ($ tempWriter );
78
+
79
+ return $ tempWriter ->__toString ();
80
+ }
81
+
71
82
public function variables (): array
72
83
{
73
84
return $ this ->variables ;
You can’t perform that action at this time.
0 commit comments