summaryrefslogtreecommitdiff
path: root/src/Readability.php
diff options
context:
space:
mode:
authorAndres Rey <[email protected]>2016-11-22 13:42:01 +0000
committerAndres Rey <[email protected]>2016-11-22 13:42:01 +0000
commit37dba87cce8498abaa4ef4c1892a83585abd2c43 (patch)
tree61732d9b6cb7bf4a52d428f7df6a4949aafffaf2 /src/Readability.php
parent276bec56e07eeecb9c072b47111ef7882fed7aeb (diff)
Switched from is_callable to method_exists
Diffstat (limited to 'src/Readability.php')
-rw-r--r--src/Readability.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Readability.php b/src/Readability.php
index 17db281..f7a2e3d 100644
--- a/src/Readability.php
+++ b/src/Readability.php
@@ -53,8 +53,8 @@ class Readability extends Element implements ReadabilityInterface
*/
$score = 0;
- // Check if the getAttribute is callable, as some elements lack of it (and calling it anyway throws an exception)
- if (is_callable('getAttribute', false, $node)) {
+ // Check if the getAttribute method exists, as some elements lack of it (and calling it anyway throws an exception)
+ if (method_exists($node, 'getAttribute')) {
$hasScore = $node->getAttribute('data-readability');
if ($hasScore !== '') {
// Node was initialized previously. Restoring score and setting flag.
@@ -255,8 +255,8 @@ class Readability extends Element implements ReadabilityInterface
*/
public function setContentScore($score)
{
- // Check if the getAttribute is callable, as some elements lack of it (and calling it anyway throws an exception)
- if (is_callable('getAttribute', false, $node)) {
+ // 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;
// Set score in an attribute of the tag to prevent losing it while creating new Readability objects.