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

ConsumerA::flushMessages()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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