mirror of
https://github.com/Chouchen/ShikiryuRSS.git
synced 2024-05-09 15:21:31 +02:00
37 lines
729 B
PHP
37 lines
729 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 Source extends HasValidator implements SRSSElement
|
|
{
|
|
/**
|
|
* @validate url
|
|
* @format url
|
|
*/
|
|
protected ?string $url = null;
|
|
|
|
/**
|
|
* @validate nohtml
|
|
* @format nohtml
|
|
*/
|
|
protected ?string $value = null;
|
|
|
|
public function isValid(): bool
|
|
{
|
|
try {
|
|
return (new Validator())->isObjectValid($this);
|
|
} catch (ReflectionException) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public function toArray(): array
|
|
{
|
|
return get_object_vars($this);
|
|
}
|
|
} |