From 7aad20cb30221f8e4d6996bba74adf01fd16c5c8 Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Tue, 2 Jan 2018 01:24:27 -0200 Subject: [PATCH] [SvnDownloader] Improve plurals and singulars --- src/Composer/Downloader/SvnDownloader.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Composer/Downloader/SvnDownloader.php b/src/Composer/Downloader/SvnDownloader.php index b3c8c33d8..9cde1537b 100644 --- a/src/Composer/Downloader/SvnDownloader.php +++ b/src/Composer/Downloader/SvnDownloader.php @@ -126,10 +126,17 @@ class SvnDownloader extends VcsDownloader $changes = array_map(function ($elem) { return ' '.$elem; }, preg_split('{\s*\r?\n\s*}', $changes)); - $this->io->writeError(' The package has modified files:'); + $countChanges = count($changes); + $this->io->writeError(sprintf(' The package has modified file%s:', $countChanges === 1 ? '' : 's')); $this->io->writeError(array_slice($changes, 0, 10)); - if (count($changes) > 10) { - $this->io->writeError(' '.count($changes) - 10 . ' more files modified, choose "v" to view the full list'); + if ($countChanges > 10) { + $remaingChanges = $countChanges - 10; + $this->io->writeError( + sprintf( + ' '.$remaingChanges.' more file%s modified, choose "v" to view the full list', + $remaingChanges === 1 ? '' : 's' + ) + ); } while (true) {