Completed
Push — v2 ( 926424...fe16f7 )
by Faouzi
10s
created

ConsumerA   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 23
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 8 1
A getMessages() 0 4 1
A flushMessages() 0 4 1
1
<?php
2
3
namespace TestRabbitMq\Consumers;
4
5
use OldSound\RabbitMqBundle\RabbitMq\ConsumerInterface;
6
use PhpAmqpLib\Message\AMQPMessage;
7
8
use Silex\Applications;
9
10
class ConsumerA implements ConsumerInterface
11
{
12
    private $messages = [];
13
14
    public function execute(AMQPMessage $message)
15
    {
16
        $payload = json_decode($message->body, true);
17
18
        $this->messages[] = $payload;
19
20
        return true;
21
    }
22
23
    public function getMessages()
24
    {
25
        return $this->messages;
26
    }
27
28
    public function flushMessages()
29
    {
30
        $this->messages = [];
31
    }
32
}
33