2023-04-12 00:28:14 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Shikiryu\SRSS\Entity\Item;
|
|
|
|
|
2023-04-12 15:28:38 +02:00
|
|
|
use ReflectionException;
|
2023-04-12 00:28:14 +02:00
|
|
|
use Shikiryu\SRSS\Entity\SRSSElement;
|
|
|
|
use Shikiryu\SRSS\Validator\HasValidator;
|
|
|
|
use Shikiryu\SRSS\Validator\Validator;
|
|
|
|
|
|
|
|
class Enclosure extends HasValidator implements SRSSElement
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @url
|
|
|
|
*/
|
2023-04-12 14:41:45 +02:00
|
|
|
public ?string $url = null;
|
2023-04-12 00:28:14 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @int
|
|
|
|
*/
|
2023-04-12 14:41:45 +02:00
|
|
|
public ?int $length = null;
|
2023-04-12 00:28:14 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @mediaType
|
|
|
|
*/
|
2023-04-12 14:41:45 +02:00
|
|
|
public ?string $type = null;
|
2023-04-12 00:28:14 +02:00
|
|
|
|
|
|
|
public function isValid(): bool
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
return (new Validator())->isObjectValid($this);
|
2023-04-12 15:28:38 +02:00
|
|
|
} catch (ReflectionException) {
|
2023-04-12 00:28:14 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function toArray(): array
|
|
|
|
{
|
|
|
|
return get_object_vars($this);
|
|
|
|
}
|
|
|
|
}
|