ProcessCommand: move count of items to report responsibliity to reporter, where it should be

This commit is contained in:
TomasVotruba 2018-01-07 00:09:22 +01:00
parent 951a7d53de
commit 9b313728f8
2 changed files with 10 additions and 8 deletions

View File

@ -150,14 +150,8 @@ final class ProcessCommand extends Command
$this->processFiles($files);
if (count($this->diffFiles) > 0) {
$this->processCommandReporter->reportDiffFiles($this->diffFiles);
}
if (count($this->changedFiles) > 0) {
$this->processCommandReporter->reportChangedFiles($this->changedFiles);
}
$this->processCommandReporter->reportDiffFiles($this->diffFiles);
$this->processCommandReporter->reportChangedFiles($this->changedFiles);
$this->consoleStyle->success('Rector is done!');
return 0;

View File

@ -44,6 +44,10 @@ final class ProcessCommandReporter
*/
public function reportChangedFiles(array $changedFiles): void
{
if (count($changedFiles) <= 0) {
return;
}
$this->consoleStyle->title(sprintf(
'%d Changed file%s',
count($changedFiles),
@ -57,6 +61,10 @@ final class ProcessCommandReporter
*/
public function reportDiffFiles(array $diffFiles): void
{
if (count($diffFiles) <= 0) {
return;
}
$this->consoleStyle->title(sprintf(
'%d file%s with changes',
count($diffFiles),