Passed
Pull Request — master (#816)
by butschster
06:28
created

NullTracer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 2
b 0
f 0
dl 0
loc 19
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getContext() 0 3 1
A trace() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Telemetry;
6
7
/**
8
 * @internal The component is under development.
9
 * Something may be changed in the future. We will stable it soon.
10
 * Feedback is welcome {@link https://github.com/spiral/framework/discussions/822}.
11
 */
12
final class NullTracer extends AbstractTracer
13
{
14 151
    public function trace(
15
        string $name,
16
        callable $callback,
17
        array $attributes = [],
18
        bool $scoped = false,
19
        ?TraceKind $traceKind = null,
20
        ?int $startTime = null
21
    ): mixed {
22 151
        $span = new Span($name);
23 151
        $span->setAttributes($attributes);
24
25 151
        return $this->runScope($span, $callback);
26
    }
27
28 96
    public function getContext(): array
29
    {
30 96
        return [];
31
    }
32
}
33