2022-07-08 14:53:04 +00:00
|
|
|
<?php
|
|
|
|
|
2023-08-20 15:24:56 +00:00
|
|
|
namespace App\Values;
|
2022-07-08 14:53:04 +00:00
|
|
|
|
|
|
|
use Illuminate\Contracts\Support\Arrayable;
|
|
|
|
|
|
|
|
final class AlbumInformation implements Arrayable
|
|
|
|
{
|
2024-01-25 16:21:26 +00:00
|
|
|
public const JSON_STRUCTURE = [
|
|
|
|
'url',
|
|
|
|
'cover',
|
|
|
|
'wiki' => [
|
|
|
|
'summary',
|
|
|
|
'full',
|
|
|
|
],
|
|
|
|
'tracks' => [
|
|
|
|
'*' => [
|
|
|
|
'title',
|
|
|
|
'length',
|
|
|
|
'url',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
];
|
|
|
|
|
2022-07-18 11:00:37 +00:00
|
|
|
private function __construct(public ?string $url, public ?string $cover, public array $wiki, public array $tracks)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function make(
|
|
|
|
?string $url = null,
|
|
|
|
?string $cover = null,
|
|
|
|
array $wiki = ['summary' => '', 'full' => ''],
|
|
|
|
array $tracks = []
|
|
|
|
): self {
|
|
|
|
return new self($url, $cover, $wiki, $tracks);
|
2022-07-08 14:53:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/** @return array<mixed> */
|
|
|
|
public function toArray(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'url' => $this->url,
|
|
|
|
'cover' => $this->cover,
|
|
|
|
'wiki' => $this->wiki,
|
|
|
|
'tracks' => $this->tracks,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|