Test Failed
Push — master ( 86fa5f...d794d1 )
by Dmitry
02:18
created

Exporter::flush()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 6
nc 4
nop 2
dl 0
loc 13
rs 10
c 0
b 0
f 0
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
}