1
0
mirror of https://github.com/Chouchen/ShikiryuRSS.git synced 2025-09-10 02:24:33 +02:00

♻️ Refactores parser

For #4
This commit is contained in:
2023-04-06 11:07:06 +02:00
parent 4783124a1d
commit bc0e818bbc
11 changed files with 438 additions and 337 deletions

View File

@@ -2,7 +2,7 @@
namespace Shikiryu\SRSS\Entity;
class Item
class Item implements SRSSElement
{
public ?string $title;
public ?string $link;
@@ -15,5 +15,20 @@ class Item
public ?string $pubDate;
public ?string $source;
/**
* @var \Shikiryu\SRSS\Entity\Media\Content[]
*/
public array $medias = [];
public array $required = ['description'];
public function isValid(): bool
{
return count(array_filter($this->required, fn($field) => !empty($this->{$field}))) === 0;
}
public function toArray(): array
{
return get_object_vars($this);
}
}