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.
Passed
Pull Request — develop (#1)
by Baptiste
01:41
created

SignedLongLongInteger::fromStream()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
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\{
7
    Transport\Frame\Value,
8
};
9
use Innmind\Math\Algebra\Integer;
10
use Innmind\Stream\Readable;
11
12
final class SignedLongLongInteger implements Value
13
{
14
    private $value;
15
    private $original;
16
17 13
    public function __construct(Integer $value)
18
    {
19 13
        $this->original = $value;
20 13
    }
21
22 6
    public static function fromStream(Readable $stream): Value
23
    {
24 6
        [, $value] = unpack('q', (string) $stream->read(8));
25
26 6
        return new self(new Integer($value));
27
    }
28
29 12
    public function original(): Integer
30
    {
31 12
        return $this->original;
32
    }
33
34 12
    public function __toString(): string
35
    {
36 12
        return $this->value ?? $this->value = pack('q', $this->original->value());
37
    }
38
}
39