Skip to content
This repository has been archived by the owner on Aug 14, 2021. It is now read-only.

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
andreskrey authored and StyleCIBot committed Nov 22, 2018
1 parent 2d542fe commit 1687abe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/Nodes/NodeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function isInitialized()
*/
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.
Expand Down Expand Up @@ -179,7 +179,7 @@ public function getAttribute($attributeName)
}

/**
* Override for native hasAttribute
* Override for native hasAttribute.
*
* @see getAttribute
*
Expand Down Expand Up @@ -428,7 +428,7 @@ public function hasSingleTagInsideElement($tag)
return false;
}

/** @var DOMNode $child */
/* @var DOMNode $child */
return !($child->nodeType === XML_TEXT_NODE && !preg_match('/\S$/', $child->getTextContent()));
});
}
Expand Down Expand Up @@ -485,7 +485,7 @@ public function isElementWithoutContent()
/**
* 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
*/
Expand Down
11 changes: 5 additions & 6 deletions src/Readability.php
Original file line number Diff line number Diff line change
Expand Up @@ -700,12 +700,12 @@ private function getNodes($node)
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);
}
Expand All @@ -714,7 +714,6 @@ private function getNodes($node)
$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
Expand Down Expand Up @@ -800,8 +799,9 @@ private function removeScripts(DOMDocument $dom)
{
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);
}
}
}

Expand Down Expand Up @@ -873,7 +873,7 @@ private function prepDocument(DOMDocument $dom)
$p->removeChild($p->lastChild);
}

if ($p->parentNode->tagName === "p") {
if ($p->parentNode->tagName === 'p') {
NodeUtility::setNodeTag($p->parentNode, 'div');
}
}
Expand Down Expand Up @@ -1277,7 +1277,6 @@ public function prepArticle(DOMDocument $article)
$table->parentNode->replaceChild($cell, $table);
}
}

}

return $article;
Expand Down

0 comments on commit 1687abe

Please sign in to comment.