mirror of
https://github.com/j0k3r/php-readability.git
synced 2026-09-26 22:16:12 +00:00
@@ -24,6 +24,7 @@ jobs:
|
||||
- "8.1"
|
||||
- "8.2"
|
||||
- "8.3"
|
||||
- "8.4"
|
||||
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
|
||||
+4
-4
@@ -668,10 +668,10 @@ class Readability implements LoggerAwareInterface
|
||||
$this->logger->debug(' content length less than 6 chars, 0 embeds and either 0 images or more than 2 images');
|
||||
$toRemove = true;
|
||||
} elseif (!$isList && $weight < 25 && $linkDensity > 0.25) {
|
||||
$this->logger->debug(' weight is ' . $weight . ' < 25 and link density is ' . sprintf('%.2f', $linkDensity) . ' > 0.25');
|
||||
$this->logger->debug(' weight is ' . $weight . ' < 25 and link density is ' . \sprintf('%.2f', $linkDensity) . ' > 0.25');
|
||||
$toRemove = true;
|
||||
} elseif ($a > 2 && ($weight >= 25 && $linkDensity > 0.5)) {
|
||||
$this->logger->debug(' more than 2 links and weight is ' . $weight . ' > 25 but link density is ' . sprintf('%.2f', $linkDensity) . ' > 0.5');
|
||||
$this->logger->debug(' more than 2 links and weight is ' . $weight . ' > 25 but link density is ' . \sprintf('%.2f', $linkDensity) . ' > 0.5');
|
||||
$toRemove = true;
|
||||
} elseif ($embedCount > 3) {
|
||||
$this->logger->debug(' more than 3 embeds');
|
||||
@@ -691,10 +691,10 @@ class Readability implements LoggerAwareInterface
|
||||
$this->logger->debug(' content length less than 10 chars and 0 images, or more than 2 images');
|
||||
$toRemove = true;
|
||||
} elseif (!$isList && $weight < 25 && $linkDensity > 0.2) {
|
||||
$this->logger->debug(' weight is ' . $weight . ' lower than 0 and link density is ' . sprintf('%.2f', $linkDensity) . ' > 0.2');
|
||||
$this->logger->debug(' weight is ' . $weight . ' lower than 0 and link density is ' . \sprintf('%.2f', $linkDensity) . ' > 0.2');
|
||||
$toRemove = true;
|
||||
} elseif ($weight >= 25 && $linkDensity > 0.5) {
|
||||
$this->logger->debug(' weight above 25 but link density is ' . sprintf('%.2f', $linkDensity) . ' > 0.5');
|
||||
$this->logger->debug(' weight above 25 but link density is ' . \sprintf('%.2f', $linkDensity) . ' > 0.5');
|
||||
$toRemove = true;
|
||||
} elseif ((1 === $embedCount && $contentLength < 75) || $embedCount > 1) {
|
||||
$this->logger->debug(' 1 embed and content length smaller than 75 chars, or more than one embed');
|
||||
|
||||
@@ -335,12 +335,12 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function testAutoClosingIframeNotThrowingException(): void
|
||||
{
|
||||
$oldErrorReporting = error_reporting(\E_ALL | \E_STRICT);
|
||||
$oldErrorReporting = error_reporting(\E_ALL);
|
||||
$oldDisplayErrors = ini_set('display_errors', '1');
|
||||
// dummy function to be used to the next test
|
||||
set_error_handler(function (int $errno, string $errstr, string $errfile, int $errline, array $errcontext) {
|
||||
set_error_handler(function (int $errno, string $errstr, string $errfile, int $errline) {
|
||||
throw new \Exception($errstr, $errno);
|
||||
}, \E_ALL | \E_STRICT);
|
||||
});
|
||||
|
||||
try {
|
||||
$data = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
Reference in New Issue
Block a user