| Conditions | 4 |
| Paths | 4 |
| Total Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public function connect(array $config) |
||
| 22 | { |
||
| 23 | $config = $this->getDefaultConfiguration($config); |
||
| 24 | |||
| 25 | if ($config['key'] && $config['secret']) { |
||
| 26 | $config['credentials'] = Arr::only($config, ['key', 'secret']); |
||
| 27 | } |
||
| 28 | |||
| 29 | $options = $config['options'] ?? []; |
||
| 30 | unset($config['options']); |
||
| 31 | |||
| 32 | $queue = Arr::get($options, 'type') === 'fifo' ? new SqsFifoQueue( |
||
| 33 | new SqsClient($config), |
||
| 34 | $config['queue'], |
||
| 35 | $config['prefix'] ?? '', |
||
| 36 | $options, |
||
| 37 | ) : new SqsQueue( |
||
|
|
|||
| 38 | new SqsClient($config), |
||
| 39 | $config['queue'], |
||
| 40 | $config['prefix'] ?? '', |
||
| 41 | $options, |
||
| 42 | ); |
||
| 43 | |||
| 44 | return $queue; |
||
| 45 | } |
||
| 46 | } |
||
| 47 |