BatchConnector   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
eloc 10
dl 0
loc 20
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A connect() 0 11 1
1
<?php
2
/**
3
 * Laravel Queue for AWS Batch.
4
 *
5
 * @author    Luke Waite <[email protected]>
6
 * @copyright 2017 Luke Waite
7
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
8
 *
9
 * @link      https://github.com/dnxlabs/laravel-queue-aws-batch
10
 */
11
12
namespace DNXLabs\LaravelQueueAwsBatch\Connectors;
13
14
use Aws\Batch\BatchClient;
15
use Illuminate\Queue\Connectors\DatabaseConnector;
16
use Illuminate\Support\Arr;
17
use DNXLabs\LaravelQueueAwsBatch\Queues\BatchQueue;
18
19
class BatchConnector extends DatabaseConnector
20
{
21
    /**
22
     * Establish a queue connection.
23
     *
24
     * @param array $config
25
     *
26
     * @return \Illuminate\Contracts\Queue\Queue
27
     */
28
    public function connect(array $config)
29
    {
30
        return new BatchQueue(
31
            $this->connections->connection(Arr::get($config, 'connection')),
32
            $config['table'],
33
            $config['queue'],
34
            Arr::get($config, 'expire', 60),
35
            $config['jobDefinition'],
36
            new BatchClient([
37
                'region'  => $config['region'],
38
                'version' => '2016-08-10',
39
            ])
40
        );
41
    }
42
}
43