Add more methods to the Channel model.
This commit is contained in:
parent
0518a44d3f
commit
4832685287
@ -5,6 +5,54 @@ namespace Slovocast\Domain\Model;
|
||||
class Channel
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ?int $id,
|
||||
private string $name,
|
||||
private ?string $description = '',
|
||||
private ?string $link = '',
|
||||
private ?string $language = '',
|
||||
private ?string $copyright = '',
|
||||
private ?bool $explicit = false,
|
||||
) {}
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function getLink(): string
|
||||
{
|
||||
return $this->link;
|
||||
}
|
||||
|
||||
public function getLanguage(): string
|
||||
{
|
||||
return $this->language;
|
||||
}
|
||||
|
||||
public function getCopyright(): string
|
||||
{
|
||||
return $this->copyright;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $props The properties of the Channel model
|
||||
* @return Channel
|
||||
*/
|
||||
public static function fromArray(array $props): Channel
|
||||
{
|
||||
return self(
|
||||
$props['id'] ?? null,
|
||||
$props['name'],
|
||||
$props['description'] ?? '',
|
||||
$props['link'] ?? '',
|
||||
$props['language'] ?? '',
|
||||
$props['copyright'] ?? '',
|
||||
$props['explicit'] ?? false
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -53,20 +53,4 @@ class User
|
||||
$props['name']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a new instance of a User model
|
||||
*
|
||||
* @param string[] $props Properties for the new User model
|
||||
* @return User
|
||||
*/
|
||||
public static function newInstance(array $props): User
|
||||
{
|
||||
return new self(
|
||||
null,
|
||||
$props['email'],
|
||||
$props['password'],
|
||||
$props['name']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user