1 | <?php |
||
9 | abstract class AbstractEmitter implements EmitterInterface |
||
10 | { |
||
11 | /** |
||
12 | * @var array |
||
13 | */ |
||
14 | protected $options = [ |
||
15 | 'includeTrace' => true, |
||
16 | ]; |
||
17 | |||
18 | 3 | public function __construct(array $options = []) |
|
19 | { |
||
20 | 3 | $this->options = array_merge($this->options, $options); |
|
21 | 3 | } |
|
22 | |||
23 | 3 | public function __invoke(Throwable $throwable) : Throwable |
|
24 | { |
||
25 | 3 | ob_start(); |
|
26 | 3 | $output = $this->format($throwable); |
|
27 | 3 | ob_end_clean(); |
|
28 | |||
29 | 3 | echo $output; |
|
30 | |||
31 | 3 | return $throwable; |
|
32 | } |
||
33 | |||
34 | abstract protected function format(Throwable $throwable) : string; |
||
35 | |||
36 | final protected function formatTraceRecord(array $traceRecord, int $index, int $traceLength) : string |
||
48 | } |
||
49 |