@@ -164,11 +164,18 @@ discard block |
||
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
167 | + /** |
|
168 | + * @param string $key |
|
169 | + */ |
|
167 | 170 | public function addParam($key, $val) |
168 | 171 | { |
169 | 172 | $this->query[$key] = $val; |
170 | 173 | } |
171 | 174 | |
175 | + /** |
|
176 | + * @param string $key |
|
177 | + * @param string $val |
|
178 | + */ |
|
172 | 179 | public function addHeader($key, $val) |
173 | 180 | { |
174 | 181 | $this->headers[strtolower($key)] = $val; |
@@ -254,6 +261,9 @@ discard block |
||
254 | 261 | $this->pass = $auth['password']; |
255 | 262 | } |
256 | 263 | |
264 | + /** |
|
265 | + * @param string $url |
|
266 | + */ |
|
257 | 267 | private function getProxy($url) |
258 | 268 | { |
259 | 269 | if (isset($_SERVER['no_proxy'])) { |
@@ -301,6 +311,7 @@ discard block |
||
301 | 311 | |
302 | 312 | /** |
303 | 313 | * @param string |
314 | + * @param string $destination |
|
304 | 315 | */ |
305 | 316 | public function setDestination($destination) |
306 | 317 | { |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | if ($this->user) { |
121 | 121 | $user = $this->user; |
122 | 122 | $user .= self::ifOr($this->pass, ':'); |
123 | - $url .= $user . '@'; |
|
123 | + $url .= $user.'@'; |
|
124 | 124 | } |
125 | 125 | $url .= self::ifOr($this->host); |
126 | 126 | $url .= self::ifOr($this->port, ':'); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | private static function ifOr($str, $pre = '', $post = '') |
145 | 145 | { |
146 | 146 | if ($str) { |
147 | - return $pre . $str . $post; |
|
147 | + return $pre.$str.$post; |
|
148 | 148 | } |
149 | 149 | return ''; |
150 | 150 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | { |
187 | 187 | $headers = array(); |
188 | 188 | foreach ($this->headers as $key => $val) { |
189 | - $headers[] = strtr(ucwords(strtr($key, '-', ' ')), ' ', '-') . ': ' . $val; |
|
189 | + $headers[] = strtr(ucwords(strtr($key, '-', ' ')), ' ', '-').': '.$val; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | $url = $this->getURL(); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | if ($useRedirector) { |
222 | 222 | if ($this->host === 'api.github.com' && preg_match('%^/repos(/[^/]+/[^/]+/)zipball(.+)$%', $this->path, $_)) { |
223 | 223 | $this->host = 'codeload.github.com'; |
224 | - $this->path = $_[1] . 'legacy.zip' . $_[2]; |
|
224 | + $this->path = $_[1].'legacy.zip'.$_[2]; |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 | } else { |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | } |
246 | 246 | // is gitlab |
247 | 247 | if (in_array($authKey, $this->gitlabDomains) && 'oauth2' === $auth['password']) { |
248 | - $this->addHeader('authorization', 'Bearer ' . $auth['username']); |
|
248 | + $this->addHeader('authorization', 'Bearer '.$auth['username']); |
|
249 | 249 | $this->user = $this->pass = null; |
250 | 250 | return; |
251 | 251 | } |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | $this->destination = $destination; |
308 | 308 | if (is_dir($destination)) { |
309 | 309 | throw new FetchException( |
310 | - 'The file could not be written to ' . $destination . '. Directory exists.' |
|
310 | + 'The file could not be written to '.$destination.'. Directory exists.' |
|
311 | 311 | ); |
312 | 312 | } |
313 | 313 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | $this->fp = fopen($destination, 'wb'); |
317 | 317 | if (!$this->fp) { |
318 | 318 | throw new FetchException( |
319 | - 'The file could not be written to ' . $destination |
|
319 | + 'The file could not be written to '.$destination |
|
320 | 320 | ); |
321 | 321 | } |
322 | 322 | } |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | if (!file_exists($targetdir)) { |
328 | 328 | if (!mkdir($targetdir, 0766, true)) { |
329 | 329 | throw new FetchException( |
330 | - 'The file could not be written to ' . $fileName |
|
330 | + 'The file could not be written to '.$fileName |
|
331 | 331 | ); |
332 | 332 | } |
333 | 333 | } |
@@ -10,9 +10,7 @@ |
||
10 | 10 | use Composer\IO; |
11 | 11 | use Composer\Plugin as CPlugin; |
12 | 12 | use Composer\EventDispatcher; |
13 | -use Composer\Package; |
|
14 | 13 | use Composer\Installer; |
15 | -use Composer\DependencyResolver; |
|
16 | 14 | |
17 | 15 | class Plugin implements |
18 | 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 | } |
@@ -21,9 +21,9 @@ |
||
21 | 21 | return $ua; |
22 | 22 | } |
23 | 23 | if (defined('HHVM_VERSION')) { |
24 | - $phpVersion = 'HHVM ' . HHVM_VERSION; |
|
24 | + $phpVersion = 'HHVM '.HHVM_VERSION; |
|
25 | 25 | } else { |
26 | - $phpVersion = 'PHP ' . PHP_VERSION; |
|
26 | + $phpVersion = 'PHP '.PHP_VERSION; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | return $ua = sprintf( |