Conditions | 4 |
Paths | 3 |
Total Lines | 23 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 4.0312 |
Changes | 0 |
1 | <?php |
||
19 | 20 | public function connect(array $config) |
|
20 | { |
||
21 | 20 | $config = $this->getDefaultConfiguration($config); |
|
22 | |||
23 | 20 | if (!ends_with($config['queue'], '.fifo')) { |
|
24 | 5 | throw new InvalidArgumentException('FIFO queue name must end in ".fifo"'); |
|
25 | } |
||
26 | |||
27 | 15 | if ($config['key'] && $config['secret']) { |
|
28 | $config['credentials'] = array_only($config, ['key', 'secret']); |
||
29 | } |
||
30 | |||
31 | 15 | $group = array_pull($config, 'group', 'default'); |
|
32 | 15 | $deduplicator = array_pull($config, 'deduplicator', 'unique'); |
|
33 | |||
34 | 15 | return new SqsFifoQueue( |
|
35 | 15 | new SqsClient($config), |
|
36 | 15 | $config['queue'], |
|
37 | 15 | array_get($config, 'prefix', ''), |
|
38 | 15 | $group, |
|
39 | 9 | $deduplicator |
|
40 | 6 | ); |
|
41 | } |
||
42 | |||
66 |