mirror of
https://github.com/j0k3r/php-readability.git
synced 2026-09-27 06:26:17 +00:00
Fix “A non well formed numeric value encountered”
This commit is contained in:
+2
-2
@@ -61,7 +61,7 @@ class Readability implements LoggerAwareInterface
|
||||
// constants
|
||||
const SCORE_CHARS_IN_PARAGRAPH = 100;
|
||||
const SCORE_WORDS_IN_PARAGRAPH = 20;
|
||||
const GRANDPARENT_SCORE_DIVISOR = 2.2;
|
||||
const GRANDPARENT_SCORE_DIVISOR = 2;
|
||||
const MIN_PARAGRAPH_LENGTH = 20;
|
||||
const MIN_COMMAS_IN_PARAGRAPH = 6;
|
||||
const MIN_ARTICLE_LENGTH = 200;
|
||||
@@ -1115,7 +1115,7 @@ class Readability implements LoggerAwareInterface
|
||||
// Add the score to the parent. The grandparent gets half.
|
||||
$parentNode->getAttributeNode('readability')->value += $contentScore;
|
||||
if ($grandParentNode) {
|
||||
$grandParentNode->getAttributeNode('readability')->value += $contentScore / self::GRANDPARENT_SCORE_DIVISOR;
|
||||
$grandParentNode->getAttributeNode('readability')->value += round($contentScore / self::GRANDPARENT_SCORE_DIVISOR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user