Conditions | 6 |
Paths | 1 |
Total Lines | 18 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | 8 | public function setupOnce(): void |
|
16 | { |
||
17 | 1 | Scope::addGlobalEventProcessor( |
|
18 | 1 | static function (Event $event, ?EventHint $hint = null): Event { |
|
19 | 8 | $self = SentrySdk::getCurrentHub()->getIntegration(self::class); |
|
20 | |||
21 | if ( |
||
22 | 8 | !$self instanceof self || |
|
23 | 2 | $hint === null || |
|
24 | 2 | $hint->exception === null || |
|
25 | 1 | !method_exists($hint->exception, 'context') || |
|
26 | 8 | !is_array($hint->exception->context()) |
|
27 | ) { |
||
28 | 7 | return $event; |
|
29 | } |
||
30 | 1 | $event->setExtra(['exception_context' => $hint->exception->context()]); |
|
31 | |||
32 | 1 | return $event; |
|
33 | } |
||
37 |