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 ( 081f57...404db9 )
by Baptiste
12s queued 11s
created

UnsignedShortInteger::cut()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
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\Frame\Value;
5
6
use Innmind\AMQP\Transport\Frame\Value;
7
use Innmind\Math\{
8
    Algebra\Integer,
9
    DefinitionSet\Set,
10
    DefinitionSet\Range,
11
};
12
use Innmind\Stream\Readable;
13
14
final class UnsignedShortInteger implements Value
15
{
16
    private static $definitionSet;
17
18
    private $value;
19
    private $original;
20
21 113
    public function __construct(Integer $value)
22
    {
23 113
        $this->original = $value;
24 113
    }
25
26 64
    public static function fromStream(Readable $stream): Value
27
    {
28 64
        [, $value] = unpack('n', (string) $stream->read(2));
29
30 64
        return new self(new Integer($value));
31
    }
32
33 75
    public function original(): Integer
34
    {
35 75
        return $this->original;
36
    }
37
38 112
    public function __toString(): string
39
    {
40 112
        return $this->value ?? $this->value = pack('n', $this->original->value());
41
    }
42
43 1
    public static function definitionSet(): Set
44
    {
45 1
        return self::$definitionSet ?? self::$definitionSet = Range::inclusive(
46 1
            new Integer(0),
47 1
            new Integer(65535)
48
        );
49
    }
50
}
51