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.

Measurements   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 40
rs 10
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A add() 0 3 1
A fromString() 0 9 2
A __toString() 0 3 1
A get() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace ReactInspector;
4
5
use function array_merge;
6
use function explode;
7
use function implode;
8
9
final class Measurements
10
{
11
    /** @var array<int, Measurement> */
12
    private array $measurements = [];
13
14
    /**
15
     * @param array<int, Measurement> $measurements
16
     */
17
    public function __construct(Measurement ...$measurements)
18
    {
19
        $this->add(...$measurements);
20
    }
21
22
    public function __toString(): string
23
    {
24
        return implode(';', $this->measurements);
25
    }
26
27
    public static function fromString(string $string): Measurements
28
    {
29
        $measurements = [];
30
31
        foreach (explode(';', $string) as $tag) {
32
            $measurements[] = Measurement::fromString($tag);
33
        }
34
35
        return new Measurements(...$measurements);
36
    }
37
38
    public function add(Measurement ...$measurements): void
39
    {
40
        $this->measurements = array_merge($this->measurements, $measurements);
41
    }
42
43
    /**
44
     * @return array<int, Measurement>
45
     */
46
    public function get(): array
47
    {
48
        return $this->measurements;
49
    }
50
}
51