Completed
Push — 1.0 ( dbae57...8e8fdf )
by Marc
02:17 queued 01:07
created

ConsumerService::run()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
rs 9.4285
cc 3
eloc 6
nc 4
nop 0
1
<?php
2
3
namespace Mouf\AmqpClient;
4
5
use Mouf\AmqpClient\Objects\Queue;
6
7
class ConsumerService
8
{
9
    /**
10
     * @param Client $client
11
     */
12
    private $client;
13
14
    /**
15
     * @param Queue[] $queues
16
     */
17
    private $queues;
18
19
    /**
20
     * @param Queue[] $queues List of queue to listen
21
     */
22
    public function __construct(Client $client, $queues)
0 ignored issues
show
Unused Code introduced by
The parameter $client is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $queues is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
23
    {
24
    }
25
26
    public function run()
27
    {
28
        foreach ($this->queues as $queue) {
29
            /* @var Queue $queue */
30
            $queue->consume();
31
        }
32
33
        $channel = $this->client->getChannel();
34
35
        while (count($channel->callbacks)) {
36
            $channel->wait();
37
        }
38
    }
39
}
40