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

UnsignedOctet::definitionSet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
ccs 4
cts 4
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
/**
15
 * Same as unsigned shortshort
16
 */
17
final class UnsignedOctet implements Value
18
{
19
    private static $definitionSet;
20
21
    private $value;
22
    private $original;
23
24 137
    public function __construct(Integer $octet)
25
    {
26 137
        $this->original = $octet;
27 137
    }
28
29 82
    public static function fromStream(Readable $stream): Value
30
    {
31 82
        [, $octet] = unpack('C', (string) $stream->read(1));
32
33 82
        return new self(new Integer($octet));
34
    }
35
36 84
    public function original(): Integer
37
    {
38 84
        return $this->original;
39
    }
40
41 136
    public function __toString(): string
42
    {
43 136
        return $this->value ?? $this->value = chr($this->original->value());
1 ignored issue
show
Bug introduced by
It seems like $this->original->value() can also be of type double; however, parameter $ascii of chr() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

43
        return $this->value ?? $this->value = chr(/** @scrutinizer ignore-type */ $this->original->value());
Loading history...
44
    }
45
46 1
    public static function definitionSet(): Set
47
    {
48 1
        return self::$definitionSet ?? self::$definitionSet = Range::inclusive(
49 1
            new Integer(0),
50 1
            new Integer(255)
51
        );
52
    }
53
}
54