diff options
Diffstat (limited to 'classes/FeedItem_Common.php')
| -rw-r--r-- | classes/FeedItem_Common.php | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/classes/FeedItem_Common.php b/classes/FeedItem_Common.php index 1471dc3e3..5ec958699 100644 --- a/classes/FeedItem_Common.php +++ b/classes/FeedItem_Common.php @@ -1,18 +1,13 @@ <?php abstract class FeedItem_Common extends FeedItem { - /** @var DOMElement */ - protected $elem; - - /** @var DOMDocument */ - protected $doc; - - /** @var DOMXPath */ - protected $xpath; + protected readonly DOMElement $elem; + protected readonly DOMDocument $doc; + protected readonly DOMXPath $xpath; function __construct(DOMElement $elem, DOMDocument $doc, DOMXPath $xpath) { $this->elem = $elem; - $this->xpath = $xpath; $this->doc = $doc; + $this->xpath = $xpath; try { $source = $elem->getElementsByTagName("source")->item(0); @@ -98,12 +93,11 @@ abstract class FeedItem_Common extends FeedItem { foreach ($enclosures as $enclosure) { $enc = new FeedEnclosure(); - - $enc->type = clean($enclosure->getAttribute("type")); - $enc->link = clean($enclosure->getAttribute("url")); - $enc->length = clean($enclosure->getAttribute("length")); - $enc->height = clean($enclosure->getAttribute("height")); - $enc->width = clean($enclosure->getAttribute("width")); + $enc->type = clean($enclosure->getAttribute('type')); + $enc->link = clean($enclosure->getAttribute('url')); + $enc->length = clean($enclosure->getAttribute('length')); + $enc->height = clean($enclosure->getAttribute('height')); + $enc->width = clean($enclosure->getAttribute('width')); $medium = clean($enclosure->getAttribute("medium")); if (!$enc->type && $medium) { @@ -119,17 +113,16 @@ abstract class FeedItem_Common extends FeedItem { $enclosures = $this->xpath->query("media:group", $this->elem); foreach ($enclosures as $enclosure) { - $enc = new FeedEnclosure(); - /** @var DOMElement|null */ $content = $this->xpath->query("media:content", $enclosure)->item(0); if ($content) { - $enc->type = clean($content->getAttribute("type")); - $enc->link = clean($content->getAttribute("url")); - $enc->length = clean($content->getAttribute("length")); - $enc->height = clean($content->getAttribute("height")); - $enc->width = clean($content->getAttribute("width")); + $enc = new FeedEnclosure(); + $enc->type = clean($content->getAttribute('type')); + $enc->link = clean($content->getAttribute('url')); + $enc->length = clean($content->getAttribute('length')); + $enc->height = clean($content->getAttribute('height')); + $enc->width = clean($content->getAttribute('width')); $medium = clean($content->getAttribute("medium")); if (!$enc->type && $medium) { @@ -152,11 +145,10 @@ abstract class FeedItem_Common extends FeedItem { foreach ($enclosures as $enclosure) { $enc = new FeedEnclosure(); - - $enc->type = "image/generic"; - $enc->link = clean($enclosure->getAttribute("url")); - $enc->height = clean($enclosure->getAttribute("height")); - $enc->width = clean($enclosure->getAttribute("width")); + $enc->type = 'image/generic'; + $enc->link = clean($enclosure->getAttribute('url')); + $enc->height = clean($enclosure->getAttribute('height')); + $enc->width = clean($enclosure->getAttribute('width')); array_push($encs, $enc); } |