Skip to content

Commit

Permalink
Fix counting bug, should never be 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Baspa committed Aug 17, 2023
1 parent 7f7e896 commit 6362084
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Checks/Content/TooLongSentenceCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ public function validateContent(Response $response, Crawler $crawler): bool
// Count how many sentences needed to fix to fall below 20%
$sentencesNeededToFix = count($sentencesWithTooManyWords) - (count($phrases) * 0.2);

if ($sentencesNeededToFix < 1) {
$sentencesNeededToFix = 1;
}

$this->failureReason = __('failed.content.too_long_sentence', [
'actualValue' => count($this->actualValue),
'neededToFix' => round($sentencesNeededToFix, 0, PHP_ROUND_HALF_UP),
Expand Down

0 comments on commit 6362084

Please sign in to comment.