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.

Methods::classes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 9
ccs 8
cts 8
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\AMQP\Transport\Protocol\v091;
5
6
use Innmind\AMQP\Transport\Frame\Method;
7
use Innmind\Immutable\{
8
    MapInterface,
9
    Map,
10
};
11
12
final class Methods
13
{
14
    private static $all;
15
    private static $classes;
16
17 400
    public static function get(string $method): Method
18
    {
19 400
        return self::all()->get($method);
20
    }
21
22
    public static function class(Method $method): string
23
    {
24
        return self::classes()->get($method->class());
25
    }
26
27 52
    public static function classId(string $class): int
28
    {
29 52
        return self::classes()
30
            ->filter(static function(int $id, string $name) use ($class): bool {
31 52
                return $name === $class;
32 52
            })
33 52
            ->key();
34
    }
35
36
    /**
37
     * @return MapInterface<string, Method>
38
     */
39 400
    public static function all(): MapInterface
40
    {
41 400
        return self::$all ?? self::$all = Map::of('string', Method::class)
42 2
            ('connection.start', new Method(10, 10))
43 2
            ('connection.start-ok', new Method(10, 11))
44 2
            ('connection.secure', new Method(10, 20))
45 2
            ('connection.secure-ok', new Method(10, 21))
46 2
            ('connection.tune', new Method(10, 30))
47 2
            ('connection.tune-ok', new Method(10, 31))
48 2
            ('connection.open', new Method(10, 40))
49 2
            ('connection.open-ok', new Method(10, 41))
50 2
            ('connection.close', new Method(10, 50))
51 2
            ('connection.close-ok', new Method(10, 51))
52 2
            ('channel.open', new Method(20, 10))
53 2
            ('channel.open-ok', new Method(20, 11))
54 2
            ('channel.flow', new Method(20, 20))
55 2
            ('channel.flow-ok', new Method(20, 21))
56 2
            ('channel.close', new Method(20, 40))
57 2
            ('channel.close-ok', new Method(20, 41))
58 2
            ('exchange.declare', new Method(40, 10))
59 2
            ('exchange.declare-ok', new Method(40, 11))
60 2
            ('exchange.delete', new Method(40, 20))
61 2
            ('exchange.delete-ok', new Method(40, 21))
62 2
            ('queue.declare', new Method(50, 10))
63 2
            ('queue.declare-ok', new Method(50, 11))
64 2
            ('queue.bind', new Method(50, 20))
65 2
            ('queue.bind-ok', new Method(50, 21))
66 2
            ('queue.unbind', new Method(50, 50))
67 2
            ('queue.unbind-ok', new Method(50, 51))
68 2
            ('queue.purge', new Method(50, 30))
69 2
            ('queue.purge-ok', new Method(50, 31))
70 2
            ('queue.delete', new Method(50, 40))
71 2
            ('queue.delete-ok', new Method(50, 41))
72 2
            ('basic.qos', new Method(60, 10))
73 2
            ('basic.qos-ok', new Method(60, 11))
74 2
            ('basic.consume', new Method(60, 20))
75 2
            ('basic.consume-ok', new Method(60, 21))
76 2
            ('basic.cancel', new Method(60, 30))
77 2
            ('basic.cancel-ok', new Method(60, 31))
78 2
            ('basic.publish', new Method(60, 40))
79 2
            ('basic.return', new Method(60, 50))
80 2
            ('basic.deliver', new Method(60, 60))
81 2
            ('basic.get', new Method(60, 70))
82 2
            ('basic.get-ok', new Method(60, 71))
83 2
            ('basic.get-empty', new Method(60, 72))
84 2
            ('basic.ack', new Method(60, 80))
85 2
            ('basic.reject', new Method(60, 90))
86 2
            ('basic.recover-async', new Method(60, 100))
87 2
            ('basic.recover', new Method(60, 110))
88 2
            ('basic.recover-ok', new Method(60, 111))
89 2
            ('tx.select', new Method(90, 10))
90 2
            ('tx.select-ok', new Method(90, 11))
91 2
            ('tx.commit', new Method(90, 20))
92 2
            ('tx.commit-ok', new Method(90, 21))
93 2
            ('tx.rollback', new Method(90, 30))
94 400
            ('tx.rollback-ok', new Method(90, 31));
95
    }
96
97
    /**
98
     * @return MapInterface<int, string>
99
     */
100 168
    public static function classes(): MapInterface
101
    {
102 168
        return self::$classes ?? self::$classes = Map::of('int', 'string')
103 2
            (10, 'connection')
104 2
            (20, 'channel')
105 2
            (40, 'exchange')
106 2
            (50, 'queue')
107 2
            (60, 'basic')
108 168
            (90, 'tx');
109
    }
110
}
111