aboutsummaryrefslogtreecommitdiff
path: root/cli/i18n/I18nUsageValidator.php
diff options
context:
space:
mode:
Diffstat (limited to 'cli/i18n/I18nUsageValidator.php')
-rw-r--r--cli/i18n/I18nUsageValidator.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/cli/i18n/I18nUsageValidator.php b/cli/i18n/I18nUsageValidator.php
index 2e402faf0..681e17326 100644
--- a/cli/i18n/I18nUsageValidator.php
+++ b/cli/i18n/I18nUsageValidator.php
@@ -16,6 +16,12 @@ class I18nUsageValidator implements I18nValidatorInterface {
}
public function displayReport() {
+ if ($this->failedEntries > $this->totalEntries) {
+ throw new \RuntimeException('The number of unused strings cannot be higher than the number of strings');
+ }
+ if ($this->totalEntries === 0) {
+ return 'There is no data.' . PHP_EOL;
+ }
return sprintf('%5.1f%% of translation keys are unused.', $this->failedEntries / $this->totalEntries * 100) . PHP_EOL;
}