Files
iptv-docker/src/app/Core/Playlist.php
AnthonyAxenov c43439b9cc Большое обновление
- проект переписан на flight + twig, laravel-like хелперы
- docker-окружение
- новая страница с подробностями о плейлисте
- улучшен json о плейлисте
- нормальный роутинг
- нормальная статусная система
- попытка перекодировки при не utf-8 + предупреждение об этом
- дополнены FAQ + README
2022-09-01 19:54:43 +08:00

46 lines
1.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
declare(strict_types = 1);
namespace App\Core;
class Playlist extends BasicPlaylist
{
public ?string $name;
public ?string $desc;
public string $pls;
public ?string $src;
public string $url;
/**
* @throws \Exception
*/
public function __construct(public string $id, array $params)
{
empty($params['pls']) && throw new \Exception(
"Плейлист с ID=$id обязан иметь параметр pls или redirect"
);
$this->url = str_replace(['http://', 'https://'], '', base_url($id));
$this->name = $params['name'] ?? "Плейлист #$id";
$this->desc = $params['desc'] ?? null;
$this->pls = $params['pls'];
$this->src = $params['src'] ?? null;
}
public function toArray(): array
{
return [
'id' => $this->id,
'url' => $this->url,
'name' => $this->name,
'desc' => $this->desc,
'pls' => $this->pls,
'src' => $this->src,
];
}
}