RabbitMqConnector   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 31
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A connect() 0 4 1
1
<?php
2
3
namespace Ccovey\LaravelRabbitMQ;
4
5
use Ccovey\RabbitMQ\Connection\ConnectionInterface;
6
use Ccovey\RabbitMQ\Consumer\Consumer;
7
use Ccovey\RabbitMQ\Consumer\ConsumerInterface;
8
use Ccovey\RabbitMQ\ExchangeDeclarer;
9
use Ccovey\RabbitMQ\Producer\Producer;
10
use Ccovey\RabbitMQ\Producer\ProducerInterface;
11
use Ccovey\RabbitMQ\QueueDeclarer;
12
use Illuminate\Contracts\Queue\Queue;
13
use Illuminate\Queue\Connectors\ConnectorInterface;
14
15
class RabbitMqConnector implements ConnectorInterface
16
{
17
    /**
18
     * @var ConsumerInterface
19
     */
20
    private $consumer;
21
22
    /**
23
     * @var ProducerInterface
24
     */
25
    private $producer;
26
27
    /** @var array */
28
    private $configuration;
29
30
    public function __construct(
31
        ConsumerInterface $consumer,
32
        ProducerInterface $producer,
33
        array $configuration
34
    )
35
    {
36
        $this->consumer = $consumer;
37
        $this->producer = $producer;
38
        $this->configuration = $configuration;
39
    }
40
41
    public function connect(array $config) : Queue
42
    {
43
        return new RabbitMqQueue($this->consumer, $this->producer, $this->configuration);
44
    }
45
}
46