Completed
Push — master ( 65967c...597be2 )
by Cody
02:06
created

Producer::publish()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Ccovey\RabbitMQ\Producer;
4
5
use Ccovey\RabbitMQ\ChannelInterface;
6
use Ccovey\RabbitMQ\Connection\ConnectionInterface;
7
8
class Producer implements ProducerInterface
9
{
10
    /**
11
     * @var ConnectionInterface
12
     */
13
    private $connection;
14
15
    /**
16
     * @var ChannelInterface
17
     */
18
    private $channel;
19
20 2
    public function __construct(ConnectionInterface $connection, string $channelId = '')
21
    {
22 2
        $this->connection = $connection;
23 2
        $this->channel = $this->connection->getChannel($channelId);
24 2
    }
25
26 2
    public function publish(Publishable $message)
27
    {
28 2
        $this->channel->publish($message);
29 2
    }
30
31
    public function getChannel() : ChannelInterface
32
    {
33
        return $this->channel;
34
    }
35
}
36