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

82 lines
1.4 KiB
PHP

<?php
namespace Shikiryu\SRSS\Entity\Media;
use ReflectionException;
use Shikiryu\SRSS\Entity\SRSSElement;
use Shikiryu\SRSS\Validator\HasValidator;
use Shikiryu\SRSS\Validator\Validator;
class Content extends HasValidator implements SRSSElement
{
/**
* @url
*/
public ?string $url = null;
/**
* @int
*/
public ?int $filesize = null;
/**
* @mediaType
*/
public ?string $type = null;
/**
* @mediaMedium
*/
public ?string $medium = null;
/**
* @bool
*/
public ?bool $isDefault = null;
/**
* @mediaExpression
*/
public ?string $expression = null;
/**
* @int
*/
public ?int $bitrate = null;
/**
* @int
*/
public ?int $framerate = null;
/**
* @float
*/
public ?float $samplerate = null;
/**
* @int
*/
public ?int $channels = null;
/**
* @int
*/
public ?int $duration = null;
/**
* @int
*/
public ?int $height = null;
/**
* @int
*/
public ?int $width = null;
/**
* @lang
*/
public ?string $lang = null;
public function isValid(): bool
{
try {
return (new Validator())->isObjectValid($this);
} catch (ReflectionException) {
return false;
}
}
public function toArray(): array
{
return get_object_vars($this);
}
}