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

Producer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 77.78%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 28
ccs 7
cts 9
cp 0.7778
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A publish() 0 4 1
A getChannel() 0 4 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