diff options
-rw-r--r-- | src/Nodes/NodeTrait.php | 8 | ||||
-rw-r--r-- | src/Readability.php | 11 |
2 files changed, 9 insertions, 10 deletions
diff --git a/src/Nodes/NodeTrait.php b/src/Nodes/NodeTrait.php index 51035ec..d7060cc 100644 --- a/src/Nodes/NodeTrait.php +++ b/src/Nodes/NodeTrait.php @@ -81,7 +81,7 @@ trait NodeTrait */ public function isReadabilityDataTable() { - /** + /* * This is a workaround that I'd like to remove in the future. * Seems that although we are extending the base DOMElement and adding custom properties (like this one, * 'readabilityDataTable'), these properties get lost when you search for elements with getElementsByTagName. @@ -179,7 +179,7 @@ trait NodeTrait } /** - * Override for native hasAttribute + * Override for native hasAttribute. * * @see getAttribute * @@ -428,7 +428,7 @@ trait NodeTrait return false; } - /** @var DOMNode $child */ + /* @var DOMNode $child */ return !($child->nodeType === XML_TEXT_NODE && !preg_match('/\S$/', $child->getTextContent())); }); } @@ -485,7 +485,7 @@ trait NodeTrait /** * Determine if a node qualifies as phrasing content. - * https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content + * https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content. * * @return bool */ diff --git a/src/Readability.php b/src/Readability.php index 877cea9..818870f 100644 --- a/src/Readability.php +++ b/src/Readability.php @@ -700,12 +700,12 @@ class Readability if ($childNode->isPhrasingContent()) { if ($p !== null) { $p->appendChild($childNode); - } else if (!$childNode->isWhitespace()) { + } elseif (!$childNode->isWhitespace()) { $p = $this->dom->createElement('p'); $node->replaceChild($p, $childNode); $p->appendChild($childNode); } - } else if ($p !== null) { + } elseif ($p !== null) { while ($p->lastChild && $p->lastChild->isWhitespace()) { $p->removeChild($p->lastChild); } @@ -714,7 +714,6 @@ class Readability $childNode = $nextSibling; } - /* * Sites like http://mobile.slate.com encloses each paragraph with a DIV * element. DIVs with only a P element inside and no text content can be @@ -800,8 +799,9 @@ class Readability { foreach (['script', 'noscript'] as $tag) { $nodes = $dom->getElementsByTagName($tag); - foreach (iterator_to_array($nodes) as $node) + foreach (iterator_to_array($nodes) as $node) { NodeUtility::removeNode($node); + } } } @@ -873,7 +873,7 @@ class Readability $p->removeChild($p->lastChild); } - if ($p->parentNode->tagName === "p") { + if ($p->parentNode->tagName === 'p') { NodeUtility::setNodeTag($p->parentNode, 'div'); } } @@ -1277,7 +1277,6 @@ class Readability $table->parentNode->replaceChild($cell, $table); } } - } return $article; |