blob: 0304f62792ec2bdc0190e74f4507f864ab2663f4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
<?php
abstract class FormatAbstract
{
const MIME_TYPE = 'text/plain';
protected string $charset = 'UTF-8';
protected array $items = [];
protected int $lastModified;
protected array $extraInfos = [];
abstract public function stringify();
public function getMimeType(): string
{
return static::MIME_TYPE;
}
public function setCharset(string $charset)
{
$this->charset = $charset;
}
public function getCharset(): string
{
return $this->charset;
}
public function setLastModified(int $lastModified)
{
$this->lastModified = $lastModified;
}
public function setItems(array $items)
{
$this->items = $items;
}
/**
* @return FeedItem[] The items
*/
public function getItems(): array
{
return $this->items;
}
public function setExtraInfos(array $infos = [])
{
$extras = [
'name',
'uri',
'icon',
'donationUri',
];
foreach ($extras as $extra) {
if (!isset($infos[$extra])) {
$infos[$extra] = '';
}
}
$this->extraInfos = $infos;
}
public function getExtraInfos(): array
{
if (!$this->extraInfos) {
$this->setExtraInfos();
}
return $this->extraInfos;
}
}
|