From 6e9fa0706e97627e1749b0a5e6a0215c472ccaf1 Mon Sep 17 00:00:00 2001 From: Andres Rey Date: Fri, 23 Dec 2016 22:11:13 +0000 Subject: Apply fixes from StyleCI --- src/Readability.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/Readability.php') diff --git a/src/Readability.php b/src/Readability.php index 8d6ecc4..027858f 100644 --- a/src/Readability.php +++ b/src/Readability.php @@ -198,7 +198,7 @@ class Readability extends Element implements ReadabilityInterface */ public function getClassWeight() { -// TODO To implement. How to get config from html parser from readability + // TODO To implement. How to get config from html parser from readability // if ($this->getConfig()->getOption('weightClasses')) { // return 0; // } @@ -253,7 +253,7 @@ class Readability extends Element implements ReadabilityInterface { // Check if the setAttribute method exists, as some elements lack of it (and calling it anyway throws an exception) if (method_exists($this->node, 'setAttribute')) { - $this->contentScore = (float)$score; + $this->contentScore = (float) $score; // Set score in an attribute of the tag to prevent losing it while creating new Readability objects. $this->node->setAttribute('data-readability', $this->contentScore); @@ -283,7 +283,7 @@ class Readability extends Element implements ReadabilityInterface /** * Changes the node tag name. Since tagName on DOMElement is a read only value, this must be done creating a new - * element with the new tag name and importing it to the main DOMDocument + * element with the new tag name and importing it to the main DOMDocument. * * @param string $value */ @@ -316,7 +316,7 @@ class Readability extends Element implements ReadabilityInterface } /** - * Removes the current node and returns the next node to be parsed (child, sibling or parent) + * Removes the current node and returns the next node to be parsed (child, sibling or parent). * * @param Readability $node * @@ -335,11 +335,10 @@ class Readability extends Element implements ReadabilityInterface * for parents. * * @param Readability $originalNode - * @param bool $ignoreSelfAndKids + * @param bool $ignoreSelfAndKids * * @return Readability */ - public function getNextNode($originalNode, $ignoreSelfAndKids = false) { /* @@ -402,7 +401,6 @@ class Readability extends Element implements ReadabilityInterface * Replaces child node with a new one. * * @param Readability $newNode - * */ public function replaceChild(Readability $newNode) { @@ -413,7 +411,7 @@ class Readability extends Element implements ReadabilityInterface * Creates a new node based on the text content of the original node. * * @param Readability $originalNode - * @param string $tagName + * @param string $tagName * * @return Readability */ @@ -460,8 +458,9 @@ class Readability extends Element implements ReadabilityInterface * provided one. * * @param Readability $node - * @param string $tagName - * @param int $maxDepth + * @param string $tagName + * @param int $maxDepth + * * @return bool */ public function hasAncestorTag(Readability $node, $tagName, $maxDepth = 3) @@ -477,16 +476,18 @@ class Readability extends Element implements ReadabilityInterface $node = $node->getParent(); $depth++; } + return false; } /** * @param bool $filterEmptyDOMText Filter empty DOMText nodes? + * * @return array */ public function getChildren($filterEmptyDOMText = false) { - $ret = array(); + $ret = []; /** @var \DOMNode $node */ foreach ($this->node->childNodes as $node) { if ($filterEmptyDOMText && $node->nodeName === '#text' && !trim($node->nodeValue)) { -- cgit v1.2.3