| @@ -8,7 +8,6 @@ | ||
| 8 | 8 | |
| 9 | 9 | use Composer\Config as CConfig; | 
| 10 | 10 | use Composer\IO; | 
| 11 | -use Composer\Downloader; | |
| 12 | 11 | use Composer\Util; | 
| 13 | 12 | |
| 14 | 13 | /** | 
| @@ -80,6 +80,9 @@ discard block | ||
| 80 | 80 | return $cache = false; | 
| 81 | 81 | } | 
| 82 | 82 | |
| 83 | + /** | |
| 84 | + * @param string $url | |
| 85 | + */ | |
| 83 | 86 | protected function getProxy($url) | 
| 84 | 87 |      { | 
| 85 | 88 |          if (isset($_SERVER['no_proxy'])) { | 
| @@ -255,11 +258,18 @@ discard block | ||
| 255 | 258 | } | 
| 256 | 259 | } | 
| 257 | 260 | |
| 261 | + /** | |
| 262 | + * @param string $key | |
| 263 | + */ | |
| 258 | 264 | public function addParam($key, $val) | 
| 259 | 265 |      { | 
| 260 | 266 | $this->query[$key] = $val; | 
| 261 | 267 | } | 
| 262 | 268 | |
| 269 | + /** | |
| 270 | + * @param string $key | |
| 271 | + * @param string $val | |
| 272 | + */ | |
| 263 | 273 | public function addHeader($key, $val) | 
| 264 | 274 |      { | 
| 265 | 275 | $this->headers[strtolower($key)] = $val; | 
| @@ -122,7 +122,7 @@ discard block | ||
| 122 | 122 |              if ($useRedirector) { | 
| 123 | 123 |                  if ($this->host === 'api.github.com' && preg_match('%^/repos(/[^/]+/[^/]+/)zipball(.+)$%', $this->path, $_)) { | 
| 124 | 124 | $this->host = 'codeload.github.com'; | 
| 125 | - $this->path = $_[1] . 'legacy.zip' . $_[2]; | |
| 125 | + $this->path = $_[1].'legacy.zip'.$_[2]; | |
| 126 | 126 | } | 
| 127 | 127 | } | 
| 128 | 128 |          } else { | 
| @@ -146,7 +146,7 @@ discard block | ||
| 146 | 146 | } | 
| 147 | 147 | // is gitlab | 
| 148 | 148 |          if (in_array($authKey, $gitlabDomains) && 'oauth2' === $auth['password']) { | 
| 149 | -            $this->addHeader('authorization', 'Bearer ' . $auth['username']); | |
| 149 | +            $this->addHeader('authorization', 'Bearer '.$auth['username']); | |
| 150 | 150 | $this->user = $this->pass = null; | 
| 151 | 151 | return; | 
| 152 | 152 | } | 
| @@ -162,7 +162,7 @@ discard block | ||
| 162 | 162 |      { | 
| 163 | 163 | $headers = array(); | 
| 164 | 164 |          foreach ($this->headers as $key => $val) { | 
| 165 | - $headers[] = strtr(ucwords(strtr($key, '-', ' ')), ' ', '-') . ': ' . $val; | |
| 165 | + $headers[] = strtr(ucwords(strtr($key, '-', ' ')), ' ', '-').': '.$val; | |
| 166 | 166 | } | 
| 167 | 167 | |
| 168 | 168 | $url = $this->getURL(); | 
| @@ -200,7 +200,7 @@ discard block | ||
| 200 | 200 |          if ($this->user) { | 
| 201 | 201 | $user = $this->user; | 
| 202 | 202 | $user .= self::ifOr($this->pass, ':'); | 
| 203 | - $url .= $user . '@'; | |
| 203 | + $url .= $user.'@'; | |
| 204 | 204 | } | 
| 205 | 205 | $url .= self::ifOr($this->host); | 
| 206 | 206 | $url .= self::ifOr($this->port, ':'); | 
| @@ -235,7 +235,7 @@ discard block | ||
| 235 | 235 | private static function ifOr($str, $pre = '', $post = '') | 
| 236 | 236 |      { | 
| 237 | 237 |          if ($str) { | 
| 238 | - return $pre . $str . $post; | |
| 238 | + return $pre.$str.$post; | |
| 239 | 239 | } | 
| 240 | 240 | return ''; | 
| 241 | 241 | } | 
| @@ -37,6 +37,11 @@ | ||
| 37 | 37 | return $curlOpts; | 
| 38 | 38 | } | 
| 39 | 39 | |
| 40 | + /** | |
| 41 | + * @param string $key | |
| 42 | + * | |
| 43 | + * @return resource | |
| 44 | + */ | |
| 40 | 45 | private static function getCurl($key) | 
| 41 | 46 |      { | 
| 42 | 47 | static $curlCache = array(); | 
| @@ -17,12 +17,12 @@ | ||
| 17 | 17 | |
| 18 | 18 | $requests = array(); | 
| 19 | 19 |              $cachedir = $this->config->get('cache-repo-dir'); | 
| 20 | -            $cacheBase = $cachedir . DIRECTORY_SEPARATOR . str_replace('://', '---', $this->baseUrl); | |
| 20 | +            $cacheBase = $cachedir.DIRECTORY_SEPARATOR.str_replace('://', '---', $this->baseUrl); | |
| 21 | 21 |              foreach ($includes as $include => $metadata) { | 
| 22 | -                $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include); | |
| 23 | -                $cacheKey = str_replace(array('%hash%','$'), '', $include); | |
| 22 | +                $url = $this->baseUrl.'/'.str_replace('%hash%', $metadata['sha256'], $include); | |
| 23 | +                $cacheKey = str_replace(array('%hash%', '$'), '', $include); | |
| 24 | 24 |                  if ($this->cache->sha256($cacheKey) !== $metadata['sha256']) { | 
| 25 | -                    $dest = $cacheBase . DIRECTORY_SEPARATOR . str_replace('/', '-', $cacheKey); | |
| 25 | +                    $dest = $cacheBase.DIRECTORY_SEPARATOR.str_replace('/', '-', $cacheKey); | |
| 26 | 26 | $requests[] = new CopyRequest($url, $dest, false, $this->io, $this->config); | 
| 27 | 27 | } | 
| 28 | 28 | } | 
| @@ -77,7 +77,7 @@ discard block | ||
| 77 | 77 | $this->destination = $destination; | 
| 78 | 78 |          if (is_dir($destination)) { | 
| 79 | 79 | throw new FetchException( | 
| 80 | - 'The file could not be written to ' . $destination . '. Directory exists.' | |
| 80 | + 'The file could not be written to '.$destination.'. Directory exists.' | |
| 81 | 81 | ); | 
| 82 | 82 | } | 
| 83 | 83 | |
| @@ -86,7 +86,7 @@ discard block | ||
| 86 | 86 | $this->fp = fopen($destination, 'wb'); | 
| 87 | 87 |          if (!$this->fp) { | 
| 88 | 88 | throw new FetchException( | 
| 89 | - 'The file could not be written to ' . $destination | |
| 89 | + 'The file could not be written to '.$destination | |
| 90 | 90 | ); | 
| 91 | 91 | } | 
| 92 | 92 | } | 
| @@ -97,7 +97,7 @@ discard block | ||
| 97 | 97 |          if (!file_exists($targetdir)) { | 
| 98 | 98 |              if (!mkdir($targetdir, 0766, true)) { | 
| 99 | 99 | throw new FetchException( | 
| 100 | - 'The file could not be written to ' . $fileName | |
| 100 | + 'The file could not be written to '.$fileName | |
| 101 | 101 | ); | 
| 102 | 102 | } | 
| 103 | 103 | } | 
| @@ -28,8 +28,8 @@ | ||
| 28 | 28 | private static function getPHPVersion() | 
| 29 | 29 |      { | 
| 30 | 30 |          if (defined('HHVM_VERSION')) { | 
| 31 | - return 'HHVM ' . HHVM_VERSION; | |
| 31 | + return 'HHVM '.HHVM_VERSION; | |
| 32 | 32 | } | 
| 33 | - return 'PHP ' . PHP_VERSION; | |
| 33 | + return 'PHP '.PHP_VERSION; | |
| 34 | 34 | } | 
| 35 | 35 | } |