2024-05-14 02:06:01 +00:00
|
|
|
<?php
|
|
|
|
|
2024-05-24 01:24:57 +00:00
|
|
|
namespace Slovocast\Domain\Entity;
|
2024-05-14 02:06:01 +00:00
|
|
|
|
2024-05-30 01:44:03 +00:00
|
|
|
use Slovocast\Domain\Entity;
|
|
|
|
|
2024-05-14 02:06:01 +00:00
|
|
|
class Channel
|
|
|
|
{
|
2024-05-30 01:44:03 +00:00
|
|
|
use Entity;
|
|
|
|
|
2024-05-14 02:06:01 +00:00
|
|
|
public function __construct(
|
|
|
|
private string $name,
|
2024-05-15 01:56:48 +00:00
|
|
|
private ?string $description = '',
|
|
|
|
private ?string $link = '',
|
|
|
|
private ?string $language = '',
|
|
|
|
private ?string $copyright = '',
|
|
|
|
private ?bool $explicit = false,
|
2024-05-14 02:06:01 +00:00
|
|
|
) {}
|
2024-05-15 01:56:48 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
{
|
2024-05-30 01:44:03 +00:00
|
|
|
$channel = new self(
|
2024-05-15 01:56:48 +00:00
|
|
|
$props['name'],
|
|
|
|
$props['description'] ?? '',
|
|
|
|
$props['link'] ?? '',
|
|
|
|
$props['language'] ?? '',
|
|
|
|
$props['copyright'] ?? '',
|
|
|
|
$props['explicit'] ?? false
|
|
|
|
);
|
2024-05-30 01:44:03 +00:00
|
|
|
|
|
|
|
if ($props['id']) {
|
|
|
|
$channel->setId($props['id']);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($props['createdAt']) {
|
|
|
|
$channel->setCreatedAt($props['createdAt']);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($props['updatedAt']) {
|
|
|
|
$channel->setUpdatedAt($props['updatedAt']);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $channel;
|
2024-05-15 01:56:48 +00:00
|
|
|
}
|
2024-05-14 02:06:01 +00:00
|
|
|
}
|