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 ( fa7ae3...61903e )
by Baptiste
03:04
created

Table   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 5
dl 0
loc 41
c 0
b 0
f 0
ccs 19
cts 19
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 28 3
A __toString() 0 4 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\Immutable\{
8
    Str,
9
    Sequence as Seq,
10
    MapInterface
11
};
12
13
final class Table implements Value
14
{
15
    private $value;
16
17
    /**
18
     * @param MapInterface<string, Value> $map
19
     */
20 4
    public function __construct(MapInterface $map)
21
    {
22
        if (
23 4
            (string) $map->keyType() !== 'string' ||
24 4
            (string) $map->valueType() !== Value::class
25
        ) {
26 1
            throw new \TypeError(sprintf(
1 ignored issue
show
Unused Code introduced by
The call to TypeError::__construct() has too many arguments starting with sprintf('Argument 1 must...ort\Frame\Value::class).

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
27 1
                'Argument 1 must be of type MapInterface<string, %s>',
28 1
                Value::class
29
            ));
30
        }
31
32
        $data = $map
33 3
            ->reduce(
34 3
                new Seq,
35 3
                static function(Seq $sequence, string $key, Value $value): Seq {
36
                    return $sequence
37 2
                        ->add(new ShortString(new Str($key)))
38 2
                        ->add($value);
39 3
                }
40
            )
41 3
            ->join('');
42
43 3
        $this->value = (string) new UnsignedLongInteger(
44 3
            $data->toEncoding('ASCII')->length()
45
        );
46 3
        $this->value .= $data;
47 3
    }
48
49 2
    public function __toString(): string
50
    {
51 2
        return $this->value;
52
    }
53
}
54