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.

bootstrap()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 64
Code Lines 44

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 31
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 44
nc 1
nop 1
dl 0
loc 64
ccs 31
cts 31
cp 1
crap 2
rs 9.216
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\AMQP;
5
6
use Innmind\Socket\Internet\Transport as Socket;
7
use Innmind\Url\UrlInterface;
8
use Innmind\TimeContinuum\{
9
    TimeContinuumInterface,
10
    ElapsedPeriod,
11
};
12
use Innmind\CLI\Command as CLICommand;
13
use Innmind\OperatingSystem\{
14
    CurrentProcess,
15
    CurrentProcess\Signals,
16
    Remote,
17
};
18
use Innmind\Immutable\{
19
    SetInterface,
20
    MapInterface,
21
};
22
use Psr\Log\LoggerInterface;
23
24
function bootstrap(LoggerInterface $logger = null): array
25
{
26
    return [
27
        'client' => [
28
            'basic' => static function(
29
                Socket $transport,
30
                UrlInterface $server,
31
                ElapsedPeriod $timeout,
32
                TimeContinuumInterface $clock,
33
                CurrentProcess $process,
34
                Remote $remote
35
            ) use (
36 2
                $logger
37
            ): Client {
38 2
                $connection = new Transport\Connection\Lazy(
39 2
                    $transport,
40 1
                    $server,
41 2
                    new Transport\Protocol\v091\Protocol(
42 2
                        new Transport\Protocol\ArgumentTranslator\ValueTranslator
43
                    ),
44 1
                    $timeout,
45 1
                    $clock,
46 1
                    $remote
47
                );
48
49 2
                if ($logger instanceof LoggerInterface) {
50 2
                    $connection = new Transport\Connection\Logger($connection, $logger);
51
                }
52
53 2
                return new Client\Client($connection, $process);
54 2
            },
55
            'fluent' => static function(Client $client): Client {
56 2
                return new Client\Fluent($client);
57 2
            },
58
            'logger' => static function(Client $client) use ($logger): Client {
59 2
                return new Client\Logger($client, $logger);
60 2
            },
61
            'signal_aware' => static function(Client $client, Signals $signals): Client {
62 2
                return new Client\SignalAware($client, $signals);
63 2
            },
64
            'auto_declare' => static function(SetInterface $exchanges, SetInterface $queues, SetInterface $bindings): callable {
65
                return static function(Client $client) use ($exchanges, $queues, $bindings): Client {
66 2
                    return new Client\AutoDeclare($client, $exchanges, $queues, $bindings);
67 2
                };
68 2
            },
69
        ],
70
        'command' => [
71
            'purge' => static function(Client $client): CLICommand {
72 2
                return new Command\Purge($client);
73 2
            },
74
            'get' => static function(MapInterface $consumers): callable {
75
                return static function(Client $client) use ($consumers): CLICommand {
76 2
                    return new Command\Get($client, new Consumers($consumers));
77 2
                };
78 2
            },
79
            'consume' => static function(MapInterface $consumers): callable {
80
                return static function(Client $client) use ($consumers): CLICommand {
81 2
                    return new Command\Consume($client, new Consumers($consumers));
82 2
                };
83 2
            },
84
        ],
85
        'producers' => static function(SetInterface $exchanges): callable {
86
            return static function(Client $client) use ($exchanges): Producers {
87 2
                return Producers::fromDeclarations($client, ...$exchanges);
88 2
            };
89 2
        },
90
    ];
91
}
92