Skip to content

Commit

Permalink
Merge branch 'flesch-reading-ease-score' of github.com:vormkracht10/l…
Browse files Browse the repository at this point in the history
…aravel-seo-scanner into flesch-reading-ease-score
  • Loading branch information
Baspa committed Aug 18, 2023
2 parents 28825a7 + 24020bc commit e03fed0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Checks/Content/FleschReadingEaseCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Vormkracht10\Seo\Checks\Content;

use Illuminate\Http\Client\Response;
use Vormkracht10\Seo\Traits\Actions;
use Vormkracht10\Seo\Interfaces\Check;
use Symfony\Component\DomCrawler\Crawler;
use Vormkracht10\Seo\Interfaces\Check;
use Vormkracht10\Seo\Traits\Actions;
use Vormkracht10\Seo\Traits\PerformCheck;

class FleschReadingEaseCheck implements Check
Expand Down Expand Up @@ -98,19 +98,19 @@ private function getAverageSyllableCountPerWord(array $sentences): float
{
$totalSyllableCount = 0;
$totalWordCount = 0;

foreach ($sentences as $sentence) {
$words = explode(' ', $sentence);

foreach ($words as $word) {
$totalSyllableCount += $this->countSyllables($word);
$totalWordCount++;
}
}

if ($totalWordCount > 0) {
$averageSyllables = $totalSyllableCount / $totalWordCount;

return round($averageSyllables, 2, PHP_ROUND_HALF_UP);
} else {
return 0; // Handle case of empty input
Expand Down

0 comments on commit e03fed0

Please sign in to comment.