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

🚧 Add complex types from docs

This commit is contained in:
Shikiryu
2023-04-12 00:28:14 +02:00
parent cb6fff0dae
commit cc7a1ec831
8 changed files with 283 additions and 14 deletions

View File

@@ -0,0 +1,39 @@
<?php
namespace Shikiryu\SRSS\Entity\Item;
use Shikiryu\SRSS\Entity\SRSSElement;
use Shikiryu\SRSS\Validator\HasValidator;
use Shikiryu\SRSS\Validator\Validator;
class Enclosure extends HasValidator implements SRSSElement
{
/**
* @url
*/
public string $url;
/**
* @int
*/
public int $length;
/**
* @mediaType
*/
public string $type;
public function isValid(): bool
{
try {
return (new Validator())->isObjectValid($this);
} catch (\ReflectionException $e) {
return false;
}
}
public function toArray(): array
{
return get_object_vars($this);
}
}