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

Exporter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 17
rs 10
c 0
b 0
f 0
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
}