rss-bridge/lib/FormatAbstract.php

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

57 lines
1.1 KiB
PHP
Raw Normal View History

<?php
2023-09-25 22:18:48 +03:00
abstract class FormatAbstract
{
public const ITUNES_NS = 'http://www.itunes.com/dtds/podcast-1.0.dtd';
const MIME_TYPE = 'text/plain';
protected array $feed = [];
2023-09-25 22:18:48 +03:00
protected array $items = [];
protected int $lastModified;
2024-08-23 18:34:06 +03:00
abstract public function render(): string;
public function setFeed(array $feed)
{
$default = [
'name' => '',
'uri' => '',
'icon' => '',
'donationUri' => '',
];
$this->feed = array_merge($default, $feed);
}
public function getFeed(): array
{
return $this->feed;
}
2023-10-13 12:24:22 +03:00
public function setItems(array $items): void
{
foreach ($items as $item) {
$this->items[] = FeedItem::fromArray($item);
}
}
2023-09-25 22:18:48 +03:00
/**
* @return FeedItem[] The items
*/
public function getItems(): array
{
return $this->items;
}
public function getMimeType(): string
{
return static::MIME_TYPE;
}
public function setLastModified(int $lastModified)
{
$this->lastModified = $lastModified;
}
}