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.

GlobalState::reset()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace WyriHaximus\React\Inspector\F42;
4
5
final class GlobalState
6
{
7
    const DEFAULT_STATE = [
8
        'read'  => 0,
9 1
        'write' => 0,
10
    ];
11 1
12
    static protected $state = self::DEFAULT_STATE;
13
14 1
    public static function get(): array
15
    {
16 1
        return self::$state;
17 1
    }
18
19 1
    public static function reset()
20
    {
21 1
        foreach(self::$state as $index => $value) {
22 1
            self::$state[$index] = 0;
23
        }
24 1
    }
25
26 1
    public static function set(string $key, int $value)
27 1
    {
28
        self::$state[$key] = $value;
29
    }
30 1
31 1
    public static function incr(string $key, int $value = 1)
32
    {
33
        if (!isset(self::$state[$key])) {
34
            self::$state[$key] = 0;
35
        }
36
37
        self::$state[$key] += $value;
38
    }
39
}
40