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.

MaxFrameSize::__construct()   A
last analyzed

Complexity

Conditions 4
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 4

Importance

Changes 0
Metric Value
cc 4
eloc 3
nc 2
nop 1
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 4
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\AMQP\Model\Connection;
5
6
use Innmind\AMQP\Exception\DomainException;
7
8
final class MaxFrameSize
9
{
10
    private $value;
11
12 134
    public function __construct(int $value)
13
    {
14 134
        if ($value < 0 || ($value !== 0 && $value < 9)) {
15 18
            throw new DomainException;
16
        }
17
18 116
        $this->value = $value;
19 116
    }
20
21 112
    public function isLimited(): bool
22
    {
23 112
        return $this->value > 0;
24
    }
25
26 92
    public function allows(int $size): bool
27
    {
28 92
        if (!$this->isLimited()) {
29 92
            return true;
30
        }
31
32 92
        return $size <= $this->value;
33
    }
34
35 102
    public function toInt(): int
36
    {
37 102
        return $this->value;
38
    }
39
}
40