mirror of
https://github.com/j0k3r/php-readability.git
synced 2026-09-26 22:16:12 +00:00
Fix tests
`getInnerText` might receive a null DOMElement if the xpath or query return no element.
This commit is contained in:
+2
-4
@@ -235,8 +235,6 @@ class Readability implements LoggerAwareInterface
|
||||
* Load HTML in a DOMDocument.
|
||||
* Apply Pre filters
|
||||
* Cleanup HTML using Tidy (or not).
|
||||
*
|
||||
* @return [type] [description]
|
||||
*/
|
||||
private function loadHtml()
|
||||
{
|
||||
@@ -1053,9 +1051,9 @@ class Readability implements LoggerAwareInterface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInnerText(\DOMElement $e, $normalizeSpaces = true, $flattenLines = false)
|
||||
public function getInnerText(\DOMElement $e = null, $normalizeSpaces = true, $flattenLines = false)
|
||||
{
|
||||
if (!isset($e->textContent) || $e->textContent === '') {
|
||||
if (null === $e || !isset($e->textContent) || $e->textContent === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user