1
0
mirror of https://github.com/Chouchen/ShikiryuRSS.git synced 2024-05-16 05:11:31 +02:00
ShikiryuRSS/src/Entity/Item/Enclosure.php

40 lines
730 B
PHP

<?php
namespace Shikiryu\SRSS\Entity\Item;
use ReflectionException;
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 = null;
/**
* @int
*/
public ?int $length = null;
/**
* @mediaType
*/
public ?string $type = null;
public function isValid(): bool
{
try {
return (new Validator())->isObjectValid($this);
} catch (ReflectionException) {
return false;
}
}
public function toArray(): array
{
return get_object_vars($this);
}
}