Refactor getProxyUri

Get proxyuserpwd only if proxy not empty.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
This commit is contained in:
Daniel Kesselberg 2019-02-24 19:24:13 +01:00
parent 2708d26407
commit fd1d85365c
No known key found for this signature in database
GPG Key ID: 36E3664E099D0614
1 changed files with 6 additions and 9 deletions

View File

@ -96,21 +96,18 @@ class Client implements IClient {
*/ */
private function getProxyUri(): ?string { private function getProxyUri(): ?string {
$proxyHost = $this->config->getSystemValue('proxy', null); $proxyHost = $this->config->getSystemValue('proxy', null);
$proxyUserPwd = $this->config->getSystemValue('proxyuserpwd', null);
if ($proxyHost === null && $proxyUserPwd === null) { if ($proxyHost === null) {
return null; return null;
} }
$proxyUri = ''; $proxyUserPwd = $this->config->getSystemValue('proxyuserpwd', null);
if ($proxyUserPwd !== null) {
$proxyUri .= $proxyUserPwd . '@'; if ($proxyUserPwd === null) {
} return $proxyHost;
if ($proxyHost !== null) {
$proxyUri .= $proxyHost;
} }
return $proxyUri; return $proxyUserPwd . '@' . $proxyHost;
} }
/** /**