File tree 1 file changed +9
-10
lines changed
1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -39,18 +39,17 @@ public function __construct($config = 'sqs:')
39
39
{
40
40
if (empty ($ config ) || 'sqs: ' === $ config ) {
41
41
$ config = [];
42
- }
43
-
44
- if (is_string ($ config )) {
42
+ } elseif (is_string ($ config )) {
45
43
$ config = $ this ->parseDsn ($ config );
46
- }
44
+ } elseif (is_array ($ config )) {
45
+ $ dsn = array_key_exists ('dsn ' , $ config ) ? $ config ['dsn ' ] : null ;
46
+ unset($ config ['dsn ' ]);
47
47
48
- if (!is_array ($ config )) {
49
- throw new \LogicException ('The config must be either an array of options, a DSN string, or null ' );
50
- }
51
-
52
- if (count ($ config ) == 1 && array_key_exists ('dsn ' , $ config )) {
53
- $ config = $ this ->parseDsn ($ config ['dsn ' ]);
48
+ if ($ dsn ) {
49
+ $ config = array_replace ($ config , $ this ->parseDsn ($ dsn ));
50
+ }
51
+ } else {
52
+ throw new \LogicException ('The config must be either an array of options, a DSN string or null ' );
54
53
}
55
54
56
55
$ this ->config = array_replace ($ this ->defaultConfig (), $ config );
You can’t perform that action at this time.
0 commit comments