2023-04-06 00:38:26 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Shikiryu\SRSS\Entity;
|
|
|
|
|
2023-04-06 11:07:06 +02:00
|
|
|
class Item implements SRSSElement
|
2023-04-06 00:38:26 +02:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
|
2023-04-06 11:07:06 +02:00
|
|
|
/**
|
|
|
|
* @var \Shikiryu\SRSS\Entity\Media\Content[]
|
|
|
|
*/
|
|
|
|
public array $medias = [];
|
|
|
|
|
2023-04-06 00:38:26 +02:00
|
|
|
public array $required = ['description'];
|
2023-04-06 11:07:06 +02:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2023-04-06 00:38:26 +02:00
|
|
|
}
|