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 ( 414a11...09e31d )
by Baptiste
01:42
created

Version::higherThan()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
c 0
b 0
f 0
rs 9.4285
cc 3
eloc 6
nc 3
nop 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
    public function __construct(int $major, int $minor, int $fix)
15
    {
16
        if (min($major, $minor, $fix) < 0) {
17
            throw new DomainException;
18
        }
19
20
        $this->major = $major;
21
        $this->minor = $minor;
22
        $this->fix = $fix;
23
    }
24
25
    public function higherThan(self $version): bool
26
    {
27
        if ($this->major !== $version->major) {
28
            return $this->major > $version->major;
29
        }
30
31
        if ($this->minor !== $version->minor) {
32
            return $this->minor > $version->minor;
33
        }
34
35
        return $this->fix > $version->fix;
36
    }
37
38
    public function __toString(): string
39
    {
40
        return sprintf(
41
            "AMQP\x00%s%s%s",
42
            chr($this->major),
43
            chr($this->minor),
44
            chr($this->fix)
45
        );
46
    }
47
}
48