File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ class Readability implements LoggerAwareInterface
61
61
// constants
62
62
const SCORE_CHARS_IN_PARAGRAPH = 100 ;
63
63
const SCORE_WORDS_IN_PARAGRAPH = 20 ;
64
- const GRANDPARENT_SCORE_DIVISOR = 2.2 ;
64
+ const GRANDPARENT_SCORE_DIVISOR = 2 ;
65
65
const MIN_PARAGRAPH_LENGTH = 20 ;
66
66
const MIN_COMMAS_IN_PARAGRAPH = 6 ;
67
67
const MIN_ARTICLE_LENGTH = 200 ;
@@ -1115,7 +1115,7 @@ protected function grabArticle(\DOMElement $page = null)
1115
1115
// Add the score to the parent. The grandparent gets half.
1116
1116
$ parentNode ->getAttributeNode ('readability ' )->value += $ contentScore ;
1117
1117
if ($ grandParentNode ) {
1118
- $ grandParentNode ->getAttributeNode ('readability ' )->value += $ contentScore / self ::GRANDPARENT_SCORE_DIVISOR ;
1118
+ $ grandParentNode ->getAttributeNode ('readability ' )->value += round ( $ contentScore / self ::GRANDPARENT_SCORE_DIVISOR ) ;
1119
1119
}
1120
1120
}
1121
1121
Original file line number Diff line number Diff line change @@ -193,7 +193,7 @@ public function testWithAside()
193
193
$ this ->assertEmpty ($ readability ->getTitle ()->getInnerHtml ());
194
194
$ this ->assertContains ('This is an awesome text with some links, here there are ' , $ readability ->getContent ()->getInnerHtml ());
195
195
$ this ->assertNotContains ('<aside> ' , $ readability ->getContent ()->getInnerHtml ());
196
- $ this ->assertContains ('<footer readability="4 "/> ' , $ readability ->getContent ()->getInnerHtml ());
196
+ $ this ->assertContains ('<footer readability="5 "/> ' , $ readability ->getContent ()->getInnerHtml ());
197
197
}
198
198
199
199
public function testWithClasses ()
You can’t perform that action at this time.
0 commit comments