mirror of
https://github.com/Chouchen/ShikiryuRSS.git
synced 2024-11-01 02:48:51 +01:00
39 lines
685 B
PHP
39 lines
685 B
PHP
|
<?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);
|
||
|
}
|
||
|
}
|