src/Model/SongInfo.php
public static function fromApi(array $data): self
    {
        $tags = self::createTagsFromApi($data);

        $artist = null;

        if (isset($data['artist'])) {
            if (\is_array($data['artist'])) {
                $artist = Artist::fromApi($data['artist']);
            } else {
                $artist = new Artist($data['artist'], null, [], null);
            }
        }

        return new self(
            $data['name'],
            $data['mbid'] ?? null,
            isset($data['duration']) ? (int) $data['duration'] : null,
            $artist,
            isset($data['listeners']) ? (int) $data['listeners'] : 0,
            isset($data['playcount']) ? (int) $data['playcount'] : 0,
            $tags
        );
    }
public static function fromApi(array $data): self
    {
        $tags = self::createTagsFromApi($data);

        $artist = null;

        if (isset($data['artist'])) {
            if (\is_array($data['artist'])) {
                $artist = Artist::fromApi($data['artist']);
            } else {
                $artist = new Artist($data['artist'], null, [], null);
            }
        }

        return new self(
            $data['name'],
            $data['mbid'] ?? null,
            isset($data['duration']) ? (int) $data['duration'] : null,
            $artist,
            isset($data['listeners']) ? (int) $data['listeners'] : 0,
            isset($data['playcount']) ? (int) $data['playcount'] : 0,
            $tags
        );
    }
@param array $data

@return SongInfo