mirror of
https://github.com/Chouchen/ShikiryuRSS.git
synced 2026-01-09 21:42:30 +01:00
🚧 Add complex types from docs
This commit is contained in:
33
src/Entity/Item/Category.php
Normal file
33
src/Entity/Item/Category.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Shikiryu\SRSS\Entity\Item;
|
||||
|
||||
use Shikiryu\SRSS\Entity\SRSSElement;
|
||||
use Shikiryu\SRSS\Validator\HasValidator;
|
||||
use Shikiryu\SRSS\Validator\Validator;
|
||||
|
||||
class Category extends HasValidator implements SRSSElement
|
||||
{
|
||||
/**
|
||||
* @string
|
||||
*/
|
||||
public string $domain;
|
||||
/**
|
||||
* @string
|
||||
*/
|
||||
public string $value;
|
||||
|
||||
public function isValid(): bool
|
||||
{
|
||||
try {
|
||||
return (new Validator())->isObjectValid($this);
|
||||
} catch (\ReflectionException $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return get_object_vars($this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user