Test Failed
Pull Request — master (#3)
by
unknown
18:49
created

SentryContextProcessor   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 13
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Paysera\LoggingExtraBundle\Service\Processor;
6
7
use Monolog\Processor\ProcessorInterface;
8
9
class SentryContextProcessor implements ProcessorInterface
10
{
11
    public function __invoke(array $record)
12
    {
13
        $record['context']['extra'] = ($record['context']['extra'] ?? []) + $record['extra'] + $record['context'];
14
        if (isset($record['extra']['correlation_id'])) {
15
            $record['context']['tags']['correlation_id'] = $record['extra']['correlation_id'];
16
        }
17
        unset($record['context']['extra']['tags']);
18
        unset($record['context']['extra']['exception']);
19
        return $record;
20
    }
21
}
22