private function LintCommand::displayTxt in Lockr 7.3
1 call to LintCommand::displayTxt()
- LintCommand::display in vendor/
symfony/ yaml/ Command/ LintCommand.php
File
- vendor/
symfony/ yaml/ Command/ LintCommand.php, line 142
Class
- LintCommand
- Validates YAML files syntax and outputs encountered errors.
Namespace
Symfony\Component\Yaml\CommandCode
private function displayTxt(SymfonyStyle $io, array $filesInfo) {
$countFiles = \count($filesInfo);
$erroredFiles = 0;
foreach ($filesInfo as $info) {
if ($info['valid'] && $this->displayCorrectFiles) {
$io
->comment('<info>OK</info>' . ($info['file'] ? sprintf(' in %s', $info['file']) : ''));
}
elseif (!$info['valid']) {
++$erroredFiles;
$io
->text('<error> ERROR </error>' . ($info['file'] ? sprintf(' in %s', $info['file']) : ''));
$io
->text(sprintf('<error> >> %s</error>', $info['message']));
}
}
if (0 === $erroredFiles) {
$io
->success(sprintf('All %d YAML files contain valid syntax.', $countFiles));
}
else {
$io
->warning(sprintf('%d YAML files have valid syntax and %d contain errors.', $countFiles - $erroredFiles, $erroredFiles));
}
return min($erroredFiles, 1);
}