| Total Complexity | 4 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | final class Producers |
||
| 13 | { |
||
| 14 | private $producers; |
||
| 15 | |||
| 16 | 6 | public function __construct(Client $client, string ...$exchanges) |
|
| 17 | { |
||
| 18 | 6 | $this->producers = Sequence::of(...$exchanges)->reduce( |
|
| 19 | 6 | new Map('string', Producer::class), |
|
| 20 | static function(Map $producers, string $exchange) use ($client): Map { |
||
| 21 | 4 | return $producers->put( |
|
| 22 | 4 | $exchange, |
|
| 23 | 4 | new Producer\Producer($client, $exchange) |
|
| 24 | ); |
||
| 25 | 6 | } |
|
| 26 | ); |
||
| 27 | 6 | } |
|
| 28 | |||
| 29 | 4 | public static function fromDeclarations(Client $client, Declaration ...$exchanges): self |
|
| 30 | { |
||
| 31 | 4 | return new self( |
|
| 32 | 4 | $client, |
|
| 33 | ...Sequence::of(...$exchanges)->map(static function(Declaration $exchange): string { |
||
| 34 | 2 | return $exchange->name(); |
|
| 35 | 4 | }) |
|
| 36 | ); |
||
| 37 | } |
||
| 38 | |||
| 39 | 2 | public function get(string $exchange): Producer |
|
| 42 | } |
||
| 43 | |||
| 44 | 4 | public function contains(string $exchange): bool |
|
| 47 | } |
||
| 48 | } |
||
| 49 |