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.
Completed
Push — develop ( f55c18...052a19 )
by Baptiste
03:17
created

Symbols::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 0
dl 0
loc 2
ccs 0
cts 1
cp 0
crap 2
rs 10
c 0
b 0
f 0
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
0 ignored issues
show
Coding Style introduced by
Possible parse error: non-abstract method defined as abstract
Loading history...
28
    {
29
        self::init();
30
31
        return self::$symbols->get($symbol);
0 ignored issues
show
Coding Style introduced by
It is generally advisable to only define one property per statement.

Only declaring a single property per statement allows you to later on add doc comments more easily.

It is also recommended by PSR2, so it is a common style that many people expect.

Loading history...
Coding Style introduced by
The visibility should be declared for property $symbols.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
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 = (new Map('string', 'string'))
41 1
            ->put('b', SignedOctet::class)
42 1
            ->put('B', UnsignedOctet::class)
43 1
            ->put('U', SignedShortInteger::class)
44 1
            ->put('u', UnsignedShortInteger::class)
45 1
            ->put('I', SignedLongInteger::class)
46 1
            ->put('i', UnsignedLongInteger::class)
47 1
            ->put('L', SignedLongLongInteger::class)
48 1
            ->put('l', UnsignedLongLongInteger::class)
49 1
            ->put('D', Decimal::class)
50 1
            ->put('T', Timestamp::class)
51 1
            ->put('V', VoidValue::class)
52 1
            ->put('t', Bits::class)
53 1
            ->put('s', ShortString::class)
54 1
            ->put('S', LongString::class)
55 1
            ->put('A', Sequence::class)
56 1
            ->put('F', Table::class);
57 1
        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