Since: 2023-03-20

class WaterMelon

Fetch all information about a song, song's albums and song's artists from the melon.com API.

Properties

SongInterface $song
AlbumInterface $album
ArtistInterface[] $artists

Methods

__construct(SongInterface $song, AlbumInterface $album, array $artists = [])

Constructor.

static WaterMelon
make(int $songId, Client|null $client = null)

Create a new WaterMelon instance from a song ID.

parse()

To get a instance of the WaterMelon class after fetching information about a song from the melon.com API.

getSong()

Getter to get a information about a song.

getAlbum()

Getter to get a information about a album.

array
getArtists()

Getter to get a information about artists.

Details

at line 35
__construct(SongInterface $song, AlbumInterface $album, array $artists = [])

Constructor.

Parameters

SongInterface $song

Melon song.

AlbumInterface $album

Melon album.

array $artists

Melon artists.

at line 51
static WaterMelon make(int $songId, Client|null $client = null)

Create a new WaterMelon instance from a song ID.

Parameters

int $songId

Melon song ID

Client|null $client

HTTP client instance

Return Value

WaterMelon

at line 66
WaterMelon parse()

To get a instance of the WaterMelon class after fetching information about a song from the melon.com API.

Return Value

WaterMelon

at line 82
SongInterface getSong()

Getter to get a information about a song.

Return Value

SongInterface

Examples

WaterMelon::make(35945927)->getSong();

at line 92
AlbumInterface getAlbum()

Getter to get a information about a album.

Return Value

AlbumInterface

Examples

WaterMelon::make(35945927)->getAlbum();

at line 104
array getArtists()

Getter to get a information about artists.

Return Value

array

Examples

WaterMelon::make(35945927)->getArtists();