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

ConsumerService   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 33
wmc 4
lcom 1
cbo 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A run() 0 13 3
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