Total Complexity | 6 |
Total Lines | 63 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
12 | class ErrorResourceBuilder |
||
13 | { |
||
14 | private $traceStack = true; |
||
15 | |||
16 | /** |
||
17 | * Trace the whole exception stack. |
||
18 | * |
||
19 | * @return ErrorResourceBuilder |
||
20 | */ |
||
21 | 1 | public function traceStack(): self |
|
22 | { |
||
23 | 1 | $this->traceStack = true; |
|
24 | |||
25 | 1 | return $this; |
|
26 | } |
||
27 | |||
28 | /** |
||
29 | * Only evaluate the topmost exception in stack. |
||
30 | * |
||
31 | * @return ErrorResourceBuilder |
||
32 | */ |
||
33 | 1 | public function doNotTraceStack(): self |
|
38 | } |
||
39 | |||
40 | /** |
||
41 | * Build an error resource from an exception. |
||
42 | * |
||
43 | * @param Throwable $exception |
||
44 | * |
||
45 | * @throws ReflectionException |
||
46 | * |
||
47 | * @return Error[] |
||
48 | */ |
||
49 | 10 | public function build(Throwable $exception): array |
|
59 | } |
||
60 | |||
61 | /** |
||
62 | * Create an error from an exception. |
||
63 | * |
||
64 | * @param Throwable $exception |
||
65 | * |
||
66 | * @throws ReflectionException |
||
67 | * |
||
68 | * @return Error |
||
69 | */ |
||
70 | 10 | private function createError(Throwable $exception): Error |
|
75 | } |
||
76 | } |
||
77 |