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

SignedLongLongInteger   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 25
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A original() 0 3 1
A fromStream() 0 5 1
A __construct() 0 3 1
A __toString() 0 3 1
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\Algebra\Integer;
8
use Innmind\Stream\Readable;
9
10
final class SignedLongLongInteger implements Value
11
{
12
    private $value;
13
    private $original;
14
15 13
    public function __construct(Integer $value)
16
    {
17 13
        $this->original = $value;
18 13
    }
19
20 6
    public static function fromStream(Readable $stream): Value
21
    {
22 6
        [, $value] = unpack('q', (string) $stream->read(8));
23
24 6
        return new self(new Integer($value));
25
    }
26
27 12
    public function original(): Integer
28
    {
29 12
        return $this->original;
30
    }
31
32 12
    public function __toString(): string
33
    {
34 12
        return $this->value ?? $this->value = pack('q', $this->original->value());
35
    }
36
}
37