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.

Type::fromInt()   A
last analyzed

Complexity

Conditions 5
Paths 5

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 5

Importance

Changes 0
Metric Value
cc 5
eloc 11
nc 5
nop 1
dl 0
loc 17
ccs 10
cts 10
cp 1
crap 5
rs 9.6111
c 0
b 0
f 0
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\AMQP\Transport\Frame;
5
6
use Innmind\AMQP\Exception\UnknownFrameType;
7
8
final class Type
9
{
10
    private const METHOD = 1;
11
    private const HEADER = 2;
12
    private const BODY = 3;
13
    private const HEARTBEAT = 8;
14
15
    private static $method;
16
    private static $header;
17
    private static $body;
18
    private static $heartbeat;
19
20
    private $value;
21
22 4
    private function __construct(int $value)
23
    {
24 4
        $this->value = $value;
25 4
    }
26
27 186
    public static function method(): self
28
    {
29 186
        return self::$method ?? self::$method = new self(self::METHOD);
30
    }
31
32 62
    public static function header(): self
33
    {
34 62
        return self::$header ?? self::$header = new self(self::HEADER);
35
    }
36
37 54
    public static function body(): self
38
    {
39 54
        return self::$body ?? self::$body = new self(self::BODY);
40
    }
41
42 108
    public static function heartbeat(): self
43
    {
44 108
        return self::$heartbeat ?? self::$heartbeat = new self(self::HEARTBEAT);
45
    }
46
47 114
    public static function fromInt(int $value): self
48
    {
49
        switch ($value) {
50 114
            case self::METHOD:
51 98
                return self::method();
52
53 50
            case self::HEADER:
54 36
                return self::header();
55
56 46
            case self::BODY:
57 36
                return self::body();
58
59 10
            case self::HEARTBEAT:
60 4
                return self::heartbeat();
61
62
            default:
63 6
                throw new UnknownFrameType((string) $value);
64
        }
65
    }
66
67 200
    public function toInt(): int
68
    {
69 200
        return $this->value;
70
    }
71
}
72