diff options
author | Andres Rey <[email protected]> | 2017-11-29 23:08:54 +0000 |
---|---|---|
committer | Andres Rey <[email protected]> | 2017-11-29 23:08:54 +0000 |
commit | 47043143fb0fb5d3b74a77499d620e77a0ac9940 (patch) | |
tree | 415b5187700ac9f00ad93621891722bf32cc927c | |
parent | 61afdb993c44a0927bbb180f5c3124ca3ed76124 (diff) |
Make initialized property private
-rw-r--r-- | src/NodeClass/NodeClassTrait.php | 14 | ||||
-rw-r--r-- | src/Readability.php | 2 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/NodeClass/NodeClassTrait.php b/src/NodeClass/NodeClassTrait.php index 467b170..9dd6db7 100644 --- a/src/NodeClass/NodeClassTrait.php +++ b/src/NodeClass/NodeClassTrait.php @@ -15,7 +15,7 @@ trait NodeClassTrait /** * @var bool */ - public $initialized = false; + private $initialized = false; /** * @var array @@ -26,13 +26,23 @@ trait NodeClassTrait ]; /** + * initialized getter + * + * @return bool + */ + public function isInitialized() + { + return $this->initialized; + } + + /** * Initializer. Calculates the current score of the node and returns a full Readability object. * * @return self */ public function initializeNode() { - if (!$this->initialized) { + if (!$this->isInitialized()) { $contentScore = 0; switch ($this->nodeName) { diff --git a/src/Readability.php b/src/Readability.php index f3eac77..2c62ae6 100644 --- a/src/Readability.php +++ b/src/Readability.php @@ -772,7 +772,7 @@ class Readability /** @var $ancestor DOMElement */ foreach ($ancestors as $level => $ancestor) { - if (!$ancestor->initialized) { + if (!$ancestor->isInitialized()) { $ancestor->initializeNode(); $candidates[] = $ancestor; } |