ValidateCommand: factorize $printSchemaUrl code

main
Guilliam Xavier 4 years ago committed by GitHub
parent b5e41d6792
commit 901d177179
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -126,23 +126,25 @@ EOT
private function outputResult($io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false, $isStrict = false)
{
$doPrintSchemaUrl = false;
if (!$errors && !$publishErrors && !$warnings) {
$io->write('<info>' . $name . ' is valid</info>');
} elseif (!$errors && !$publishErrors) {
$io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
if ($printSchemaUrl) {
$io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
}
$doPrintSchemaUrl = $printSchemaUrl;
} elseif (!$errors) {
$io->writeError('<info>' . $name . ' is valid for simple usage with composer but has</info>');
$io->writeError('<info>strict errors that make it unable to be published as a package:</info>');
if ($printSchemaUrl) {
$io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
}
$doPrintSchemaUrl = $printSchemaUrl;
} else {
$io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
}
if ($doPrintSchemaUrl) {
$io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
}
$allWarnings = $warnings;
// If checking publish errors, display them as errors, otherwise just show them as warnings

Loading…
Cancel
Save