mirror of
https://github.com/Chouchen/ShikiryuRSS.git
synced 2024-05-19 18:21:31 +02:00
52 lines
1022 B
PHP
52 lines
1022 B
PHP
<?php
|
|
|
|
namespace Shikiryu\SRSS\Entity\Channel;
|
|
|
|
use Shikiryu\SRSS\Entity\SRSSElement;
|
|
use Shikiryu\SRSS\Validator\HasValidator;
|
|
use Shikiryu\SRSS\Validator\Validator;
|
|
|
|
class Image extends HasValidator implements SRSSElement
|
|
{
|
|
/**
|
|
* @required
|
|
* @url
|
|
*/
|
|
public string $url;
|
|
/**
|
|
* @required
|
|
* @nohtml
|
|
*/
|
|
public string $title;
|
|
/**
|
|
* @required
|
|
* @url
|
|
*/
|
|
public string $link;
|
|
/**
|
|
* @int
|
|
* @max 144
|
|
*/
|
|
public int $width = 88; // Maximum value for width is 144, default value is 88.
|
|
/**
|
|
* @int
|
|
* @max 400
|
|
*/
|
|
public int $height = 31; //Maximum value for height is 400, default value is 31.
|
|
|
|
public string $description;
|
|
|
|
public function isValid(): bool
|
|
{
|
|
try {
|
|
return (new Validator())->isObjectValid($this);
|
|
} catch (\ReflectionException $e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public function toArray(): array
|
|
{
|
|
return get_object_vars($this);
|
|
}
|
|
} |