1 | <?php |
||
10 | final class Error implements JsonSerializable |
||
11 | { |
||
12 | /** |
||
13 | * @var Context|null |
||
14 | */ |
||
15 | private $context; |
||
16 | |||
17 | /** |
||
18 | * @var string|null |
||
19 | */ |
||
20 | private $culprit; |
||
21 | |||
22 | /** |
||
23 | * @var Exception|null |
||
24 | */ |
||
25 | private $exception; |
||
26 | |||
27 | /** |
||
28 | * @var UuidInterface|null |
||
29 | */ |
||
30 | private $id; |
||
31 | |||
32 | /** |
||
33 | * @var Log|null |
||
34 | */ |
||
35 | private $log; |
||
36 | |||
37 | /** |
||
38 | * @var Timestamp |
||
39 | */ |
||
40 | private $timestamp; |
||
41 | |||
42 | /** |
||
43 | * @var UuidInterface|null |
||
44 | */ |
||
45 | private $transactionId; |
||
46 | |||
47 | 28 | private function __construct() |
|
50 | |||
51 | 14 | public static function fromException(Exception $exception, Timestamp $timestamp): self |
|
59 | |||
60 | 14 | public static function fromLog(Log $log, Timestamp $timestamp): self |
|
68 | |||
69 | 14 | public function inContext(Context $context): self |
|
76 | |||
77 | 1 | public function withCulprit(string $culprit): self |
|
84 | |||
85 | 1 | public function causedByException(Exception $exception): self |
|
92 | |||
93 | 14 | public function withId(UuidInterface $id): self |
|
100 | |||
101 | 1 | public function withLog(Log $log): self |
|
108 | |||
109 | 14 | public function correlatedToTransactionId(UuidInterface $id): self |
|
116 | |||
117 | /** |
||
118 | * @return mixed[] |
||
119 | */ |
||
120 | 18 | public function jsonSerialize(): array |
|
132 | } |
||
133 |