Passed
Push — master ( a7d12b...46dbe8 )
by Dmitry
03:07
created

Exporter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

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