@@ -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 | /** |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | |
| 61 | 61 | // load all classes |
| 62 | 62 | foreach (self::$pluginClasses as $class) { |
| 63 | - class_exists(__NAMESPACE__ . '\\' . $class); |
|
| 63 | + class_exists(__NAMESPACE__.'\\'.$class); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | $this->config = $composer->getConfig(); |
@@ -10,10 +10,7 @@ |
||
| 10 | 10 | use Composer\IO; |
| 11 | 11 | use Composer\Plugin as CPlugin; |
| 12 | 12 | use Composer\EventDispatcher; |
| 13 | -use Composer\Package; |
|
| 14 | -use Composer\Script; |
|
| 15 | 13 | use Composer\Installer; |
| 16 | -use Composer\DependencyResolver; |
|
| 17 | 14 | |
| 18 | 15 | class Plugin implements |
| 19 | 16 | CPlugin\PluginInterface, |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | continue; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - $destination = $cachedir . DIRECTORY_SEPARATOR . FileDownloaderDummy::getCacheKeyCompat($p, $url); |
|
| 73 | + $destination = $cachedir.DIRECTORY_SEPARATOR.FileDownloaderDummy::getCacheKeyCompat($p, $url); |
|
| 74 | 74 | if (file_exists($destination)) { |
| 75 | 75 | continue; |
| 76 | 76 | } |
@@ -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; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | foreach (array('https', 'http') as $scheme) { |
| 98 | 98 | if ($this->scheme === $scheme) { |
| 99 | - $label = $scheme . '_proxy'; |
|
| 99 | + $label = $scheme.'_proxy'; |
|
| 100 | 100 | foreach (array(strtoupper($label), $label) as $l) { |
| 101 | 101 | if (isset($_SERVER[$l])) { |
| 102 | 102 | return $_SERVER[$l]; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | if ($useRedirector) { |
| 121 | 121 | if ($this->host === 'api.github.com' && preg_match('%^/repos(/[^/]+/[^/]+/)zipball(.+)$%', $this->path, $_)) { |
| 122 | 122 | $this->host = 'codeload.github.com'; |
| 123 | - $this->path = $_[1] . 'legacy.zip' . $_[2]; |
|
| 123 | + $this->path = $_[1].'legacy.zip'.$_[2]; |
|
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | } else { |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | // is gitlab |
| 146 | 146 | if (in_array($authKey, $gitlabDomains) && 'oauth2' === $auth['password']) { |
| 147 | - $this->addHeader('authorization', 'Bearer ' . $auth['username']); |
|
| 147 | + $this->addHeader('authorization', 'Bearer '.$auth['username']); |
|
| 148 | 148 | $this->user = $this->pass = null; |
| 149 | 149 | return; |
| 150 | 150 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | { |
| 161 | 161 | $headers = array(); |
| 162 | 162 | foreach ($this->headers as $key => $val) { |
| 163 | - $headers[] = strtr(ucwords(strtr($key, '-', ' ')), ' ', '-') . ': ' . $val; |
|
| 163 | + $headers[] = strtr(ucwords(strtr($key, '-', ' ')), ' ', '-').': '.$val; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | $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(); |
@@ -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 | } |
@@ -17,12 +17,12 @@ |
||
| 17 | 17 | |
| 18 | 18 | $requests = array(); |
| 19 | 19 | $cachedir = $this->config->get('cache-repo-dir'); |
| 20 | - $cacheBase = $cachedir . DIRECTORY_SEPARATOR . strtr($this->baseUrl, ':/', '--'); |
|
| 20 | + $cacheBase = $cachedir.DIRECTORY_SEPARATOR.strtr($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 | } |