Skip to content
Snippets Groups Projects
Commit f5c88158 authored by wn_'s avatar wn_
Browse files

Handle potentially null link, title, etc. in FeedParser.

parent 7988c79b
No related branches found
No related tags found
No related merge requests found
...@@ -11,18 +11,18 @@ class FeedParser { ...@@ -11,18 +11,18 @@ class FeedParser {
private $libxml_errors = []; private $libxml_errors = [];
/** @var array<FeedItem> */ /** @var array<FeedItem> */
private $items; private $items = [];
/** @var string */ /** @var string|null */
private $link; private $link;
/** @var string */ /** @var string|null */
private $title; private $title;
/** @var int */ /** @var FeedParser::FEED_*|null */
private $type; private $type;
/** @var DOMXPath */ /** @var DOMXPath|null */
private $xpath; private $xpath;
const FEED_RDF = 0; const FEED_RDF = 0;
...@@ -49,8 +49,6 @@ class FeedParser { ...@@ -49,8 +49,6 @@ class FeedParser {
} }
} }
libxml_clear_errors(); libxml_clear_errors();
$this->items = array();
} }
function init() : void { function init() : void {
...@@ -208,11 +206,11 @@ class FeedParser { ...@@ -208,11 +206,11 @@ class FeedParser {
} }
function get_link() : string { function get_link() : string {
return clean($this->link); return clean($this->link ?? '');
} }
function get_title() : string { function get_title() : string {
return clean($this->title); return clean($this->title ?? '');
} }
/** @return array<FeedItem> */ /** @return array<FeedItem> */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment