2021-06-04 16:19:34 +00:00
|
|
|
<?php
|
|
|
|
|
2023-08-20 15:24:56 +00:00
|
|
|
namespace App\Values;
|
2021-06-04 16:19:34 +00:00
|
|
|
|
|
|
|
use Illuminate\Contracts\Support\Arrayable;
|
|
|
|
use JsonSerializable;
|
|
|
|
|
|
|
|
final class UserPreferences implements Arrayable, JsonSerializable
|
|
|
|
{
|
2022-07-29 06:47:10 +00:00
|
|
|
private function __construct(public ?string $lastFmSessionKey = null)
|
2021-06-04 16:19:34 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function make(?string $lastFmSessionKey = null): self
|
|
|
|
{
|
|
|
|
return new self($lastFmSessionKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** @return array<mixed> */
|
|
|
|
public function toArray(): array
|
|
|
|
{
|
|
|
|
return ['lastfm_session_key' => $this->lastFmSessionKey];
|
|
|
|
}
|
|
|
|
|
|
|
|
/** @return array<mixed> */
|
|
|
|
public function jsonSerialize(): array
|
|
|
|
{
|
|
|
|
return $this->toArray();
|
|
|
|
}
|
|
|
|
}
|