function ConfigCommand::handleSingleValue
Parameters
array{callable, callable} $callbacks Validator and normalizer callbacks:
array<string> $values:
1 call to ConfigCommand::handleSingleValue()
- ConfigCommand::execute in vendor/
composer/ composer/ src/ Composer/ Command/ ConfigCommand.php
File
-
vendor/
composer/ composer/ src/ Composer/ Command/ ConfigCommand.php, line 902
Class
- ConfigCommand
- @author Joshua Estes <Joshua.Estes@iostudio.com> @author Jordi Boggiano <j.boggiano@seld.be>
Namespace
Composer\CommandCode
protected function handleSingleValue(string $key, array $callbacks, array $values, string $method) : void {
[
$validator,
$normalizer,
] = $callbacks;
if (1 !== count($values)) {
throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
}
if (true !== ($validation = $validator($values[0]))) {
throw new \RuntimeException(sprintf('"%s" is an invalid value' . ($validation ? ' (' . $validation . ')' : ''), $values[0]));
}
$normalizedValue = $normalizer($values[0]);
if ($key === 'disable-tls') {
if (!$normalizedValue && $this->config
->get('disable-tls')) {
$this->getIO()
->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
}
elseif ($normalizedValue && !$this->config
->get('disable-tls')) {
$this->getIO()
->writeError('<warning>You are now running Composer with SSL/TLS protection disabled.</warning>');
}
}
call_user_func([
$this->configSource,
$method,
], $key, $normalizedValue);
}