1
0
Fork 0

ValidateCommand: factorize $printSchemaUrl code

pull/8605/head
Guilliam Xavier 2020-02-13 14:46:50 +01:00 committed by GitHub
parent b5e41d6792
commit 901d177179
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 6 deletions

View File

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