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.

Transaction::__invoke()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 20
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 4

Importance

Changes 0
Metric Value
cc 4
eloc 13
nc 4
nop 2
dl 0
loc 20
ccs 12
cts 12
cp 1
crap 4
rs 9.8333
c 0
b 0
f 0
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\AMQP\Transport\Protocol\v091\Reader;
5
6
use Innmind\AMQP\{
7
    Transport\Frame\Method,
8
    Transport\Frame\Visitor\ChunkArguments,
9
    Transport\Protocol\v091\Methods,
10
    Exception\UnknownMethod,
11
};
12
use Innmind\Stream\Readable;
13
use Innmind\Immutable\StreamInterface;
14
15
final class Transaction
16
{
17
    /**
18
     * @return StreamInterface<Value>
19
     */
20 20
    public function __invoke(Method $method, Readable $arguments): StreamInterface
21
    {
22
        switch (true) {
23 20
            case Methods::get('tx.select-ok')->equals($method):
24 10
                $chunk = $this->selectOk();
25 10
                break;
26
27 14
            case Methods::get('tx.commit-ok')->equals($method):
28 6
                $chunk = $this->commitOk();
29 6
                break;
30
31 8
            case Methods::get('tx.rollback-ok')->equals($method):
32 6
                $chunk = $this->rollbackOk();
33 6
                break;
34
35
            default:
36 2
                throw new UnknownMethod($method);
37
        }
38
39 18
        return $chunk($arguments);
40
    }
41
42 10
    private function selectOk(): ChunkArguments
43
    {
44 10
        return new ChunkArguments; //no arguments
45
    }
46
47 6
    private function commitOk(): ChunkArguments
48
    {
49 6
        return new ChunkArguments; //no arguments
50
    }
51
52 6
    private function rollbackOk(): ChunkArguments
53
    {
54 6
        return new ChunkArguments; //no arguments
55
    }
56
}
57