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 ( 14a217...c3bf76 )
by Baptiste
03:06
created

Version   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 13
lcom 1
cbo 1
dl 0
loc 68
ccs 31
cts 31
cp 1
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 2
A major() 0 4 1
A minor() 0 4 1
A fix() 0 4 1
A higherThan() 0 12 3
A compatibleWith() 0 12 4
A __toString() 0 9 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\AMQP\Transport\Protocol;
5
6
use Innmind\AMQP\Exception\DomainException;
7
8
final class Version
9
{
10
    private $major;
11
    private $minor;
12
    private $fix;
13
14 69
    public function __construct(int $major, int $minor, int $fix)
15
    {
16 69
        if (min($major, $minor, $fix) < 0) {
17 3
            throw new DomainException;
18
        }
19
20 66
        $this->major = $major;
21 66
        $this->minor = $minor;
22 66
        $this->fix = $fix;
23 66
    }
24
25 2
    public function major(): int
26
    {
27 2
        return $this->major;
28
    }
29
30 2
    public function minor(): int
31
    {
32 2
        return $this->minor;
33
    }
34
35 2
    public function fix(): int
36
    {
37 2
        return $this->fix;
38
    }
39
40 1
    public function higherThan(self $version): bool
41
    {
42 1
        if ($this->major !== $version->major) {
43 1
            return $this->major > $version->major;
44
        }
45
46 1
        if ($this->minor !== $version->minor) {
47 1
            return $this->minor > $version->minor;
48
        }
49
50 1
        return $this->fix > $version->fix;
51
    }
52
53 6
    public function compatibleWith(self $version): bool
54
    {
55 6
        if ($this->major === 0 && $version->major === 0) {
56 5
            return $this->minor === $version->minor;
57
        }
58
59 2
        if ($this->major !== $version->major) {
60 2
            return false;
61
        }
62
63 1
        return $this->minor >= $version->minor;
64
    }
65
66 4
    public function __toString(): string
67
    {
68 4
        return sprintf(
69 4
            "AMQP\x00%s%s%s",
70 4
            chr($this->major),
71 4
            chr($this->minor),
72 4
            chr($this->fix)
73
        );
74
    }
75
}
76