summaryrefslogtreecommitdiff
path: root/src/HTMLParser.php
diff options
context:
space:
mode:
authorAndres Rey <[email protected]>2016-12-10 12:08:52 +0000
committerAndres Rey <[email protected]>2016-12-10 12:08:52 +0000
commit3757f8f838687374e0cb6255928dee83492678f7 (patch)
treed9a59baac6ad4862bcb7f0f9b92653b33a35e7d6 /src/HTMLParser.php
parent1e0cc1cda41d1e9bd223dfba616c4b1351b6934e (diff)
Solved some mistakes during node parsing (before scoring)
Diffstat (limited to 'src/HTMLParser.php')
-rw-r--r--src/HTMLParser.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/HTMLParser.php b/src/HTMLParser.php
index 01c581b..92a85a4 100644
--- a/src/HTMLParser.php
+++ b/src/HTMLParser.php
@@ -889,12 +889,14 @@ class HTMLParser
private function hasSingleChildBlockElement(Readability $node)
{
- /** @var Readability $child */
- foreach ($node->getChildren() as $child) {
- if (in_array($child->getTagName(), $this->divToPElements)) {
- $this->hasSingleChildBlockElement($child);
- } else {
- return false;
+ if ($node->hasChildren()) {
+ /** @var Readability $child */
+ foreach ($node->getChildren() as $child) {
+ if (in_array($child->getTagName(), $this->divToPElements)) {
+ return true;
+ } else {
+ return $this->hasSingleChildBlockElement($child);
+ }
}
}