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:
39
src/Entity/Item/Enclosure.php
Normal file
39
src/Entity/Item/Enclosure.php
Normal 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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user