@@ -94,20 +94,20 @@ public static function fromDsn(string $dsn, array $options = [], HttpClientInter
94
94
if (isset ($ parsedUrl ['query ' ])) {
95
95
parse_str ($ parsedUrl ['query ' ], $ query );
96
96
}
97
- $ options = $ query + $ options + self ::DEFAULT_OPTIONS ;
97
+ $ mergedOptions = $ query + $ options + self ::DEFAULT_OPTIONS ;
98
98
$ configuration = [
99
- 'buffer_size ' => (int ) $ options ['buffer_size ' ],
100
- 'wait_time ' => (int ) $ options ['wait_time ' ],
101
- 'poll_timeout ' => $ options ['poll_timeout ' ],
102
- 'visibility_timeout ' => $ options ['visibility_timeout ' ],
103
- 'auto_setup ' => (bool ) $ options ['auto_setup ' ],
104
- 'queue_name ' => (string ) $ options ['queue_name ' ],
99
+ 'buffer_size ' => (int ) $ mergedOptions ['buffer_size ' ],
100
+ 'wait_time ' => (int ) $ mergedOptions ['wait_time ' ],
101
+ 'poll_timeout ' => $ mergedOptions ['poll_timeout ' ],
102
+ 'visibility_timeout ' => $ mergedOptions ['visibility_timeout ' ],
103
+ 'auto_setup ' => (bool ) $ mergedOptions ['auto_setup ' ],
104
+ 'queue_name ' => (string ) $ mergedOptions ['queue_name ' ],
105
105
];
106
106
107
107
$ clientConfiguration = [
108
- 'region ' => $ options ['region ' ],
109
- 'accessKeyId ' => urldecode ($ parsedUrl ['user ' ] ?? '' ) ?: $ options ['access_key ' ] ?? self ::DEFAULT_OPTIONS ['access_key ' ],
110
- 'accessKeySecret ' => urldecode ($ parsedUrl ['pass ' ] ?? '' ) ?: $ options ['secret_key ' ] ?? self ::DEFAULT_OPTIONS ['secret_key ' ],
108
+ 'region ' => $ mergedOptions ['region ' ],
109
+ 'accessKeyId ' => urldecode ($ parsedUrl ['user ' ] ?? '' ) ?: $ mergedOptions ['access_key ' ] ?? self ::DEFAULT_OPTIONS ['access_key ' ],
110
+ 'accessKeySecret ' => urldecode ($ parsedUrl ['pass ' ] ?? '' ) ?: $ mergedOptions ['secret_key ' ] ?? self ::DEFAULT_OPTIONS ['secret_key ' ],
111
111
];
112
112
unset($ query ['region ' ]);
113
113
@@ -116,21 +116,21 @@ public static function fromDsn(string $dsn, array $options = [], HttpClientInter
116
116
if (preg_match (';^sqs\.([^\.]++)\.amazonaws\.com$; ' , $ parsedUrl ['host ' ], $ matches )) {
117
117
$ clientConfiguration ['region ' ] = $ matches [1 ];
118
118
}
119
- unset($ query ['sslmode ' ]);
120
- } elseif (self ::DEFAULT_OPTIONS ['endpoint ' ] !== $ options ['endpoint ' ] ?? self ::DEFAULT_OPTIONS ['endpoint ' ]) {
121
- $ clientConfiguration ['endpoint ' ] = $ options ['endpoint ' ];
119
+ } elseif (self ::DEFAULT_OPTIONS ['endpoint ' ] !== $ mergedOptions ['endpoint ' ] ?? self ::DEFAULT_OPTIONS ['endpoint ' ]) {
120
+ $ clientConfiguration ['endpoint ' ] = $ mergedOptions ['endpoint ' ];
122
121
}
122
+ unset($ query ['sslmode ' ]);
123
123
124
124
$ parsedPath = explode ('/ ' , ltrim ($ parsedUrl ['path ' ] ?? '/ ' , '/ ' ));
125
125
if (\count ($ parsedPath ) > 0 && !empty ($ queueName = end ($ parsedPath ))) {
126
126
$ configuration ['queue_name ' ] = $ queueName ;
127
127
}
128
- $ configuration ['account ' ] = 2 === \count ($ parsedPath ) ? $ parsedPath [0 ] : $ options ['account ' ] ?? self ::DEFAULT_OPTIONS ['account ' ];
128
+ $ configuration ['account ' ] = 2 === \count ($ parsedPath ) ? $ parsedPath [0 ] : $ mergedOptions ['account ' ] ?? self ::DEFAULT_OPTIONS ['account ' ];
129
129
130
130
// check for extra keys in options
131
131
$ optionsExtraKeys = array_diff (array_keys ($ options ), array_keys (self ::DEFAULT_OPTIONS ));
132
132
if (0 < \count ($ optionsExtraKeys )) {
133
- throw new InvalidArgumentException (sprintf ('Unknown option found : [%s]. Allowed options are [%s]. ' , implode (', ' , $ optionsExtraKeys ), implode (', ' , array_keys (self ::DEFAULT_OPTIONS ))));
133
+ throw new InvalidArgumentException (sprintf ('Unknown option found: [%s]. Allowed options are [%s]. ' , implode (', ' , $ optionsExtraKeys ), implode (', ' , array_keys (self ::DEFAULT_OPTIONS ))));
134
134
}
135
135
136
136
// check for extra keys in options
0 commit comments