1 | <?php |
||
21 | 1 | final class Generator { |
|
22 | 1 | use \Nette\SmartObject; |
|
23 | |||
24 | /** @var string */ |
||
25 | protected $title = ""; |
||
26 | /** @var string */ |
||
27 | protected $description = ""; |
||
28 | /** @var string */ |
||
29 | protected $link = ""; |
||
30 | /** @var string */ |
||
31 | protected $dateTimeFormat = "Y-m-d H:i:s"; |
||
32 | /** @var callable|null */ |
||
33 | protected $dataSource = NULL; |
||
34 | /** @var int */ |
||
35 | protected $shortenDescription = 150; |
||
36 | /** @var callable */ |
||
37 | protected $lastBuildDate = "time"; |
||
38 | /** @var callable[] */ |
||
39 | public $onBeforeGenerate = []; |
||
40 | /** @var callable[] */ |
||
41 | public $onAddItem = []; |
||
42 | /** @var callable[] */ |
||
43 | public $onAfterGenerate = []; |
||
44 | |||
45 | public function getTitle(): string { |
||
48 | |||
49 | public function setTitle(string $title) { |
||
52 | |||
53 | public function getDescription(): string { |
||
56 | |||
57 | public function setDescription(string $description) { |
||
60 | |||
61 | public function getLink(): string { |
||
64 | |||
65 | public function setLink(string $link) { |
||
68 | |||
69 | public function setDataSource(callable $dataSource) { |
||
72 | |||
73 | public function getShortenDescription(): int { |
||
76 | |||
77 | public function setShortenDescription(int $value) { |
||
80 | |||
81 | public function getDateTimeFormat(): string { |
||
84 | |||
85 | public function setDateTimeFormat(string $format) { |
||
88 | |||
89 | public function getLastBuildDate() { |
||
92 | |||
93 | public function setLastBuildDate(callable $lastBuildDate) { |
||
96 | |||
97 | /** |
||
98 | * @throws InvalidStateException |
||
99 | * @throws \InvalidArgumentException |
||
100 | */ |
||
101 | protected function getData(): Collection { |
||
111 | |||
112 | protected function shortenDescription(string $description): string { |
||
123 | |||
124 | protected function writeProperty(\SimpleXMLElement &$channel, string $property): void { |
||
129 | |||
130 | /** |
||
131 | * @throws InvalidStateException |
||
132 | * @throws \InvalidArgumentException |
||
133 | */ |
||
134 | public function generate(): \SimpleXMLElement { |
||
159 | |||
160 | /** |
||
161 | * @throws InvalidStateException |
||
162 | * @throws \InvalidArgumentException |
||
163 | */ |
||
164 | public function response(): RssResponse { |
||
171 | } |
||
172 | ?> |