Total Complexity | 7 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | class DeclarationsRegistry |
||
6 | { |
||
7 | /** @var ExchangeDeclaration[] */ |
||
8 | public $exchanges; |
||
9 | /** @var QueueDeclaration[] */ |
||
10 | public $queues; |
||
11 | /** @var BindingDeclaration[] */ |
||
12 | public $bindings = []; |
||
13 | |||
14 | public function addExchange(ExchangeDeclaration $exchangeDeclaration) |
||
15 | { |
||
16 | if (isset($this->exchanges[$exchangeDeclaration->name])) { |
||
17 | throw new \InvalidArgumentException(sprintf('Exchange declartion with %s name already registerd', $exchangeDeclaration->name)); |
||
18 | } |
||
19 | $this->exchanges[$exchangeDeclaration->name] = $exchangeDeclaration; |
||
20 | } |
||
21 | |||
22 | public function addQueue(QueueDeclaration $queueDeclaration) |
||
23 | { |
||
24 | $this->queues[] = $queueDeclaration; |
||
25 | } |
||
26 | |||
27 | public function addBinding(BindingDeclaration $bindingDeclaration) |
||
28 | { |
||
29 | $this->bindings[] = $bindingDeclaration; |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * @param ExchangeDeclaration $exchange |
||
34 | * @return BindingDeclaration[] |
||
35 | */ |
||
36 | public function getBindingsByExchange(ExchangeDeclaration $exchange): array |
||
40 | }); |
||
41 | } |
||
42 | } |