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