2016-09-05 18:05:19 +02:00
|
|
|
<?php
|
2022-07-01 15:10:30 +02:00
|
|
|
|
2023-09-25 21:18:48 +02:00
|
|
|
abstract class FormatAbstract
|
2016-09-10 20:41:11 +02:00
|
|
|
{
|
2023-10-16 02:58:03 +02:00
|
|
|
public const ITUNES_NS = 'http://www.itunes.com/dtds/podcast-1.0.dtd';
|
|
|
|
|
2019-10-31 19:00:12 +01:00
|
|
|
const MIME_TYPE = 'text/plain';
|
2022-07-01 15:10:30 +02:00
|
|
|
|
2023-09-25 21:18:48 +02:00
|
|
|
protected string $charset = 'UTF-8';
|
|
|
|
protected array $items = [];
|
|
|
|
protected int $lastModified;
|
2022-07-01 15:10:30 +02:00
|
|
|
|
2024-01-09 20:18:33 +01:00
|
|
|
protected array $feed = [];
|
2022-07-01 15:10:30 +02:00
|
|
|
|
2024-01-09 20:18:33 +01:00
|
|
|
abstract public function stringify();
|
2022-07-01 15:10:30 +02:00
|
|
|
|
2024-01-09 20:18:33 +01:00
|
|
|
public function setFeed(array $feed)
|
2016-09-10 20:41:11 +02:00
|
|
|
{
|
2024-01-09 20:18:33 +01:00
|
|
|
$default = [
|
|
|
|
'name' => '',
|
|
|
|
'uri' => '',
|
|
|
|
'icon' => '',
|
|
|
|
'donationUri' => '',
|
|
|
|
];
|
|
|
|
$this->feed = array_merge($default, $feed);
|
2016-09-10 20:41:11 +02:00
|
|
|
}
|
2022-07-01 15:10:30 +02:00
|
|
|
|
2024-01-09 20:18:33 +01:00
|
|
|
public function getFeed(): array
|
2018-08-26 00:00:38 +05:00
|
|
|
{
|
2024-01-09 20:18:33 +01:00
|
|
|
return $this->feed;
|
2018-08-26 00:00:38 +05:00
|
|
|
}
|
2022-07-01 15:10:30 +02:00
|
|
|
|
2023-10-13 11:24:22 +02:00
|
|
|
/**
|
|
|
|
* @param FeedItem[] $items
|
|
|
|
*/
|
|
|
|
public function setItems(array $items): void
|
2016-09-10 20:41:11 +02:00
|
|
|
{
|
2018-12-26 22:41:32 +01:00
|
|
|
$this->items = $items;
|
2016-09-10 20:41:11 +02:00
|
|
|
}
|
2022-07-01 15:10:30 +02:00
|
|
|
|
2023-09-25 21:18:48 +02:00
|
|
|
/**
|
|
|
|
* @return FeedItem[] The items
|
|
|
|
*/
|
|
|
|
public function getItems(): array
|
2016-09-10 20:41:11 +02:00
|
|
|
{
|
|
|
|
return $this->items;
|
|
|
|
}
|
2022-07-01 15:10:30 +02:00
|
|
|
|
2024-01-09 20:18:33 +01:00
|
|
|
public function getMimeType(): string
|
2016-09-10 20:41:11 +02:00
|
|
|
{
|
2024-01-09 20:18:33 +01:00
|
|
|
return static::MIME_TYPE;
|
2016-09-10 20:41:11 +02:00
|
|
|
}
|
2022-07-01 15:10:30 +02:00
|
|
|
|
2024-01-09 20:18:33 +01:00
|
|
|
public function setCharset(string $charset)
|
2016-09-10 20:41:11 +02:00
|
|
|
{
|
2024-01-09 20:18:33 +01:00
|
|
|
$this->charset = $charset;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCharset(): string
|
|
|
|
{
|
|
|
|
return $this->charset;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setLastModified(int $lastModified)
|
|
|
|
{
|
|
|
|
$this->lastModified = $lastModified;
|
2016-09-10 20:41:11 +02:00
|
|
|
}
|
2016-09-05 18:05:19 +02:00
|
|
|
}
|