Skip to content

Commit

Permalink
Merge pull request #45 from DominicVonk/master
Browse files Browse the repository at this point in the history
Good stuff, thanks.
  • Loading branch information
DaveChild authored Feb 13, 2018
2 parents 0c37d62 + d61d627 commit d90054d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/DaveChild/TextStatistics/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public static function cleanText($strText)
$strText = trim(preg_replace('`[ ]*([\.])`', '$1 ', $strText)); // Pad sentence terminators

// Lower case all words following terminators (for gunning fog score)
$strText = preg_replace_callback('`\. [^\. ]`', create_function('$matches', 'return strtolower($matches[0]);'), $strText);
$strText = preg_replace_callback('`\. [^\. ]`', function($matches) { return strtolower($matches[0]); }, $strText);

$strText = trim($strText);

Expand Down Expand Up @@ -288,7 +288,7 @@ public static function wordCount($strText, $strEncoding = '')
}

// Will be tripped by em dashes with spaces either side, among other similar characters
$intWords = 1 + self::textLength(preg_replace('`[^ ]`', '', $strText), $strEncoding); // Space count + 1 is word count
$intWords = 1 + self::textLength(preg_replace('`[^ ]`', '', preg_replace('`\s+`', ' ', $strText)), $strEncoding); // Space count + 1 is word count

return $intWords;
}
Expand Down

0 comments on commit d90054d

Please sign in to comment.