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

AbstractTracer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A runScope() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Telemetry;
6
7
use Spiral\Core\Container;
8
use Spiral\Core\InvokerInterface;
9
use Spiral\Core\ScopeInterface;
10
11
/**
12
 * @internal The component is under development.
13
 * Something may be changed in the future. We will stable it soon.
14
 * Feedback is welcome {@link https://github.com/spiral/framework/discussions/822}.
15
 */
16
abstract class AbstractTracer implements TracerInterface
17
{
18 439
    public function __construct(
19
        private readonly ?ScopeInterface $scope = new Container(),
20
    ) {
21
    }
22
23
    /**
24
     * @throws \Throwable
25
     */
26 153
    final protected function runScope(Span $span, callable $callback): mixed
27
    {
28 153
        return $this->scope->runScope([
0 ignored issues
show
Bug introduced by
The method runScope() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
        return $this->scope->/** @scrutinizer ignore-call */ runScope([

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
29
            SpanInterface::class => $span,
30
            TracerInterface::class => $this,
31 153
        ], static fn (InvokerInterface $invoker): mixed => $invoker->invoke($callback));
32
    }
33
}
34