Completed
Pull Request — v2 (#16)
by Faouzi
02:28
created

ConsumerA::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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