1
0
mirror of https://github.com/Chouchen/ShikiryuRSS.git synced 2024-05-19 06:11:32 +02:00
ShikiryuRSS/src/Entity/Item.php
2023-04-06 11:07:06 +02:00

34 lines
746 B
PHP

<?php
namespace Shikiryu\SRSS\Entity;
class Item implements SRSSElement
{
public ?string $title;
public ?string $link;
public ?string $description;
public ?string $author;
public ?string $category;
public ?string $comments;
public ?string $enclosure;
public ?string $guid;
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);
}
}