RocketMQConnector::connect()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 7
ccs 0
cts 4
cp 0
crap 2
rs 10
1
<?php
2
3
namespace Freyo\LaravelQueueRocketMQ\Queue\Connectors;
4
5
use Freyo\LaravelQueueRocketMQ\Queue\RocketMQQueue;
6
use Illuminate\Queue\Connectors\ConnectorInterface;
7
use MQ\MQClient;
8
9
class RocketMQConnector implements ConnectorInterface
10
{
11
    /**
12
     * Establish a queue connection.
13
     *
14
     * @param array $config
15
     *
16
     * @throws \ReflectionException
17
     *
18
     * @return \Illuminate\Contracts\Queue\Queue
19
     */
20
    public function connect(array $config)
21
    {
22
        $client = new MQClient(
23
            $config['endpoint'], $config['access_id'], $config['access_key']
24
        );
25
26
        return new RocketMQQueue($client, $config);
27
    }
28
}
29