From 1ae0a1b7af21b7b07db0ec952b8599ba84915d9e Mon Sep 17 00:00:00 2001 From: Maxim Chernyshev Date: Wed, 2 May 2012 15:16:36 +0800 Subject: [PATCH] Follow-up coding standard fixes --- src/Composer/Util/StreamContextFactory.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Composer/Util/StreamContextFactory.php b/src/Composer/Util/StreamContextFactory.php index 0cc591484..c0e6a5f25 100644 --- a/src/Composer/Util/StreamContextFactory.php +++ b/src/Composer/Util/StreamContextFactory.php @@ -43,12 +43,10 @@ final class StreamContextFactory if (isset($proxyPort)) { $proxyURL .= ":" . $proxyPort; - } else { - if ('http://' == substr($proxyURL, 0, 7)) { - $proxyURL .= ":80"; - } else if ('https://' == substr($proxyURL, 0, 8)) { - $proxyURL .= ":443"; - } + } else if ('http://' == substr($proxyURL, 0, 7)) { + $proxyURL .= ":80"; + } else if ('https://' == substr($proxyURL, 0, 8)) { + $proxyURL .= ":443"; } // http(s):// is not supported in proxy @@ -75,14 +73,13 @@ final class StreamContextFactory $auth = base64_encode($auth); // Preserve headers if already set in default options - if (isset($defaultOptions['http']) && isset($defaultOptions['http']['header'])) { + if (isset($defaultOptions['http']['header'])) { $defaultOptions['http']['header'] .= "Proxy-Authorization: Basic {$auth}\r\n"; } else { $options['http']['header'] = "Proxy-Authorization: Basic {$auth}\r\n"; } } } - $options = array_merge_recursive($options, $defaultOptions); return stream_context_create($options, $defaultParams);