RabbitMqConnector::connect()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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