Test Failed
Pull Request — master (#39)
by Aleksandr
05:36
created

TraceableAMQPChannel::getTracedPublications()   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
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace OldSound\RabbitMqBundle\RabbitMq;
4
5
use PhpAmqpLib\Channel\AMQPChannel;
6
7
class TraceableAMQPChannel extends AMQPChannel
8
{
9
    private $tracedPublications = [];
10
11
    public function basic_publish($msg, $exchange = '', $routingKey = '', $mandatory = false, $immediate = false, $ticket = NULL)
12
    {
13
        $this->tracedPublications[] = [
14
            'msg' => $msg,
15
            'exchange' => $exchange,
16
            'routing_key' => $routingKey,
17
            'mandatory' => $mandatory,
18
            'immediate' => $immediate,
19
            'ticket' => $ticket
20
        ];
21
22
        parent::basic_publish($msg, $exchange, $routingKey, $mandatory, $immediate, $ticket);
23
    }
24
25
    public function getTracedPublications()
26
    {
27
        return $this->tracedPublications;
28
    }
29
}
30