DistributedTracing   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 12
dl 0
loc 35
ccs 0
cts 13
cp 0
rs 10
c 1
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getTraceState() 0 3 1
A toArray() 0 6 1
A getName() 0 3 1
A getTraceParent() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PascalDeVink\CloudEvents\Extension;
6
7
class DistributedTracing implements Extension
8
{
9
    private string $traceParent;
10
11
    private ?string $traceState;
12
13
    public function __construct(string $traceParent, ?string $traceState = null)
14
    {
15
        $this->traceParent = $traceParent;
16
        $this->traceState  = $traceState;
17
    }
18
19
    public function toArray() : array
20
    {
21
        return [
22
            'DistributedTracingExtension' => [
23
                'traceparent' => $this->traceParent,
24
                'tracestate'  => $this->traceState,
25
            ],
26
        ];
27
    }
28
29
    public function getName() : string
30
    {
31
        return 'DistributedTracingExtension';
32
    }
33
34
    public function getTraceParent() : string
35
    {
36
        return $this->traceParent;
37
    }
38
39
    public function getTraceState() : ?string
40
    {
41
        return $this->traceState;
42
    }
43
}
44