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.
Passed
Push — develop ( 404db9...8cc0dc )
by Baptiste
03:06 queued 15s
created

Symbols   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 92.31%

Importance

Changes 0
Metric Value
eloc 29
dl 0
loc 48
ccs 24
cts 26
cp 0.9231
rs 10
c 0
b 0
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A symbol() 0 5 1
A class() 0 5 1
A init() 0 25 2
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\AMQP\Transport\Frame\Value;
5
6
use Innmind\Immutable\{
7
    Map,
8
    Pair,
9
};
10
11
final class Symbols
12
{
13
    private static $symbols;
14
    private static $classes;
15
16
    private function __construct()
17
    {
18
    }
19
20 79
    public static function symbol(string $class): string
21
    {
22 79
        self::init();
23
24 79
        return self::$classes->get($class);
25
    }
26
27
    public static function class(string $symbol): string
28
    {
29
        self::init();
30
31
        return self::$symbols->get($symbol);
32
    }
33
34 79
    private static function init(): void
35
    {
36 79
        if (!\is_null(self::$symbols)) {
37 79
            return;
38
        }
39
40 1
        self::$symbols = Map::of('string', 'string')
41 1
            ('b', SignedOctet::class)
42 1
            ('B', UnsignedOctet::class)
43 1
            ('U', SignedShortInteger::class)
44 1
            ('u', UnsignedShortInteger::class)
45 1
            ('I', SignedLongInteger::class)
46 1
            ('i', UnsignedLongInteger::class)
47 1
            ('L', SignedLongLongInteger::class)
48 1
            ('l', UnsignedLongLongInteger::class)
49 1
            ('D', Decimal::class)
50 1
            ('T', Timestamp::class)
51 1
            ('V', VoidValue::class)
52 1
            ('t', Bits::class)
53 1
            ('s', ShortString::class)
54 1
            ('S', LongString::class)
55 1
            ('A', Sequence::class)
56 1
            ('F', Table::class);
57
        self::$classes = self::$symbols->map(static function(string $symbol, string $class): Pair {
58 1
            return new Pair($class, $symbol);
59 1
        });
60 1
    }
61
}
62