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

SentryContextProcessor::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 0
cts 7
cp 0
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 6
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