slovocast/app/src/Domain/Entity/Channel.php

59 lines
1.2 KiB
PHP
Raw Normal View History

<?php
namespace Slovocast\Domain\Entity;
class Channel
{
public function __construct(
2024-05-15 01:56:48 +00:00
private readonly ?int $id,
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-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
{
return self(
$props['id'] ?? null,
$props['name'],
$props['description'] ?? '',
$props['link'] ?? '',
$props['language'] ?? '',
$props['copyright'] ?? '',
$props['explicit'] ?? false
);
}
}