Exporter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 7
c 1
b 1
f 0
dl 0
loc 17
ccs 0
cts 7
cp 0
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A flush() 0 13 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace OpenTelemetry;
6
7
use OpenTelemetry\Tracing\Span;
8
use OpenTelemetry\Tracing\Tracer;
9
10
abstract class Exporter
11
{
12
    abstract public function convertSpan(Span $span): array;
13
14
    public function flush(Tracer $tracer, Transport $transport): int
15
    {
16
        $data = [];
17
18
        foreach ($tracer->getSpans() as $span) {
19
            $data[] = $this->convertSpan($span);
20
        }
21
22
        if (count($data)) {
23
            $transport->write($data);
24
        }
25
26
        return count($data);
27
    }
28
}
29