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 ( 142883...f1ac5a )
by Baptiste
03:34
created

Producers   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 35
ccs 19
cts 19
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A fromDeclarations() 0 6 1
A get() 0 3 1
A contains() 0 3 1
A __construct() 0 8 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\AMQP;
5
6
use Innmind\AMQP\Model\Exchange\Declaration;
7
use Innmind\Immutable\{
8
    Sequence,
9
    Map,
10
};
11
12
final class Producers
13
{
14
    private $producers;
15
16 3
    public function __construct(Client $client, string ...$exchanges)
17
    {
18 3
        $this->producers = Sequence::of(...$exchanges)->reduce(
19 3
            new Map('string', Producer::class),
20 3
            static function(Map $producers, string $exchange) use ($client): Map {
21 2
                return $producers->put(
22 2
                    $exchange,
23 2
                    new Producer\Producer($client, $exchange)
24
                );
25 3
            }
26
        );
27 3
    }
28
29 2
    public static function fromDeclarations(Client $client, Declaration ...$exchanges): self
30
    {
31 2
        return new self(
32 2
            $client,
33 2
            ...Sequence::of(...$exchanges)->map(static function(Declaration $exchange): string {
34 1
                return $exchange->name();
35 2
            })
36
        );
37
    }
38
39 1
    public function get(string $exchange): Producer
40
    {
41 1
        return $this->producers->get($exchange);
42
    }
43
44 2
    public function contains(string $exchange): bool
45
    {
46 2
        return $this->producers->contains($exchange);
47
    }
48
}
49