Skip to content

Commit 6754eb1

Browse files
authored
Make basic auth configurable via config (#105)
Solves #103
1 parent 0bdb34b commit 6754eb1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/SoapClient.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,16 @@ public function withRemoveEmptyNodes()
194194
}
195195

196196
/**
197-
* @param string $username
198-
* @param string $password
197+
* @param string|array $username
198+
* @param string|null $password
199199
* @return $this
200200
*/
201-
public function withBasicAuth(string $username, string $password)
201+
public function withBasicAuth($username, ?string $password = null)
202202
{
203+
if (is_array($username)) {
204+
['username' => $username, 'password' => $password] = $username;
205+
}
206+
203207
$this->middlewares = array_merge_recursive($this->middlewares, [
204208
'basic' => new BasicAuthMiddleware($username, $password),
205209
]);

0 commit comments

Comments
 (0)