Test Failed
Pull Request — master (#38)
by Aleksandr
16:13 queued 06:13
created

GroupConsumer   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 8
c 1
b 0
f 1
dl 0
loc 18
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addConsumers() 0 6 2
A setupConsumer() 0 4 2
1
<?php
2
3
namespace OldSound\RabbitMqBundle\RabbitMq;
4
5
use PhpAmqpLib\Connection\AbstractConnection;
6
use Symfony\Component\Console\Exception\InvalidArgumentException;
7
8
class GroupConsumer extends Consumer
9
{
10
    /** @var iterable|Consumer[] */
11
    protected $consumers = [];
12
13
    public function addConsumers(iterable $consumers)
14
    {
15
        foreach ($consumers as $consumer) {
16
            $consumer->setChannel($this->ch);
17
            $consumer->setConsumerTag(sprintf("PHPPROCESS_%s_%s_%s", gethostname(), getmypid(), count($this->consumers)));
18
            $this->consumers[] = $consumer;
19
        }
20
    }
21
22
    protected function setupConsumer()
23
    {
24
        foreach ($this->consumers as $consumer) {
25
            $consumer->setupConsumer();
26
        }
27
    }
28
}