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

ConsumerService::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 1
nc 1
nop 2
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