Passed
Pull Request — main (#42)
by Luke
09:39
created

BatchConnector   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

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