瀏覽代碼

Follow-up coding standard fixes

Maxim Chernyshev 13 年之前
父節點
當前提交
1ae0a1b7af
共有 1 個文件被更改,包括 5 次插入8 次删除
  1. 5 8
      src/Composer/Util/StreamContextFactory.php

+ 5 - 8
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);