Test Failed
Pull Request — master (#816)
by butschster
06:13 queued 32s
created

TracerFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 3
c 1
b 0
f 0
dl 0
loc 11
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fromContext() 0 4 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Telemetry;
6
7
use Spiral\Core\Container;
8
use Spiral\Core\FactoryInterface;
9
10
final class TracerFactory implements TracerFactoryInterface
11
{
12
    public function __construct(
13
        private readonly ?FactoryInterface $factory = new Container()
14
    ) {
15
    }
16
17
    public function fromContext(?array $context): TracerInterface
18
    {
19
        return $this->factory->make(TracerInterface::class)
0 ignored issues
show
Bug introduced by
The method make() 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

19
        return $this->factory->/** @scrutinizer ignore-call */ make(TracerInterface::class)

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...
20
            ->withContext($context);
21
    }
22
}
23