GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

MetricCollector   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 13
dl 0
loc 31
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A collect() 0 15 1
A __construct() 0 3 1
A cancel() 0 2 1
1
<?php declare(strict_types=1);
2
3
namespace ReactInspector\Collector;
4
5
use ReactInspector\CollectorInterface;
6
use ReactInspector\Config;
7
use ReactInspector\Measurement;
8
use ReactInspector\Measurements;
9
use ReactInspector\Metric;
10
use ReactInspector\Tag;
11
use ReactInspector\Tags;
12
use Rx\Observable;
13
use function ApiClients\Tools\Rx\observableFromArray;
14
use function hrtime;
15
16
final class MetricCollector implements CollectorInterface
17
{
18
    private float $startTime;
19 2
20
    public function __construct()
21 2
    {
22 2
        $this->startTime = hrtime(true) * 1e-9;
23
    }
24 2
25
    public function collect(): Observable
26 2
    {
27 2
        return observableFromArray([
28 2
            Metric::create(
29
                new Config(
30 2
                    'reactphp_inspector',
31
                    'counter',
32
                    ''
33 2
                ),
34 2
                new Tags(
35
                    new Tag('reactphp_inspector_internal', 'true'),
36
                ),
37
                new Measurements(
38
                    new Measurement(0.0, new Tags(new Tag('measurement', 'metrics'))),
39
                    new Measurement((hrtime(true) * 1e-9) - $this->startTime, new Tags(new Tag('measurement', 'uptime'))),
40 1
                )
41
            ),
42 1
        ]);
43
    }
44
45
    public function cancel(): void
46
    {
47
    }
48
}
49