function HttpDownloader::__construct
Parameters
IOInterface $io The IO instance:
Config $config The config:
mixed[] $options The options:
File
-
vendor/
composer/ composer/ src/ Composer/ Util/ HttpDownloader.php, line 69
Class
- HttpDownloader
- @author Jordi Boggiano <j.boggiano@seld.be> @phpstan-type Request array{url: non-empty-string, options: mixed[], copyTo: string|null} @phpstan-type Job array{id: int, status: int, request: Request, sync: bool, origin: string, resolve?: callable,…
Namespace
Composer\UtilCode
public function __construct(IOInterface $io, Config $config, array $options = [], bool $disableTls = false) {
$this->io = $io;
$this->disabled = (bool) Platform::getEnv('COMPOSER_DISABLE_NETWORK');
// Setup TLS options
// The cafile option can be set via config.json
if ($disableTls === false) {
$this->options = StreamContextFactory::getTlsDefaults($options, $io);
}
// handle the other externally set options normally.
$this->options = array_replace_recursive($this->options, $options);
$this->config = $config;
if (self::isCurlEnabled()) {
$this->curl = new CurlDownloader($io, $config, $options, $disableTls);
}
$this->rfs = new RemoteFilesystem($io, $config, $options, $disableTls);
if (is_numeric($maxJobs = Platform::getEnv('COMPOSER_MAX_PARALLEL_HTTP'))) {
$this->maxJobs = max(1, min(50, (int) $maxJobs));
}
}