summaryrefslogtreecommitdiff
path: root/src/Readability.php
diff options
context:
space:
mode:
authorAndres Rey <[email protected]>2018-11-22 22:22:04 +0000
committerGitHub <[email protected]>2018-11-22 22:22:04 +0000
commitfcbb76a9a015b85bab63324e10ddfa993be17f78 (patch)
tree8ed70368b49a0fe3da8a4b7cc1057f97446dcdc5 /src/Readability.php
parent2d542fee0bcb4c315461b69d47f3f4cac4ec7b25 (diff)
parent1687abe2a73224aaaf6ccfda84511334ad0d3261 (diff)
Merge pull request #72 from andreskrey/analysis-XVpwd6
Apply fixes from StyleCI
Diffstat (limited to 'src/Readability.php')
-rw-r--r--src/Readability.php11
1 files changed, 5 insertions, 6 deletions
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;