for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Uxmp\Core\Api\Lib;
use JsonSerializable;
use Uxmp\Core\Component\Config\ConfigProviderInterface;
use Uxmp\Core\Orm\Model\ArtistInterface;
/**
* Defines single result items for artist lists
*/
final class ArtistListItem implements JsonSerializable
{
public function __construct(
private readonly ConfigProviderInterface $config,
private readonly ArtistInterface $artist,
) {
}
* @return array{
array{
2
* id: int,
* artistId: int,
* artistName: string,
* name: string,
* cover: string,
* length: int,
* year: ?int
* }
public function jsonSerialize(): array
$artistId = $this->artist->getId();
return [
'id' => $artistId,
'name' => $this->artist->getTitle(),
'cover' => sprintf('%s/art/artist/%d', $this->config->getBaseUrl(), $artistId),
];