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

Exporter::flush()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 13
ccs 0
cts 7
cp 0
rs 10
cc 3
nc 4
nop 2
crap 12
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
}