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::collect()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 15
ccs 6
cts 6
cp 1
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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