1
0
mirror of https://github.com/Chouchen/ShikiryuRSS.git synced 2024-10-31 14:38:51 +01:00
ShikiryuRSS/src/Entity/Item/Enclosure.php

40 lines
730 B
PHP
Raw Normal View History

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