Since: 2023-03-20

class ArtistResource extends Resource

Artist resource for mapping from melon.com.

Properties

Melon $melon from  Resource
protected array $container from  Resource

Methods

array
toArray()

To get resource as array.

__construct(Melon $melon)

Constructor.

from  Resource
mixed
__get(mixed $name)

Reading data from inaccessible (protected or private) or non-existing properties.

from  Resource
void
offsetSet(mixed $offset, mixed $value)

ArrayAccess implementation.

from  Resource
bool
offsetExists(mixed $offset)

ArrayAccess implementation.

from  Resource
void
offsetUnset(mixed $offset)

ArrayAccess implementation.

from  Resource
mixed
offsetGet(mixed $offset)

ArrayAccess implementation.

from  Resource
static string|null
emptyToNull(string|null $path)

Infer the default image for Melon as null

from  Resource
static ArtistResource
make(MelonArtist $melonArtist)

Create a new ArtistResource instance.

Details

at line 19
array toArray()

To get resource as array.

Return Value

array

in Resource at line 31
__construct(Melon $melon)

Constructor.

Parameters

Melon $melon

Melon class instance

in Resource at line 41
mixed __get(mixed $name)

Reading data from inaccessible (protected or private) or non-existing properties.

Parameters

mixed $name

Return Value

mixed

in Resource at line 49
void offsetSet(mixed $offset, mixed $value)

ArrayAccess implementation.

Parameters

mixed $offset
mixed $value

Return Value

void

in Resource at line 61
bool offsetExists(mixed $offset)

ArrayAccess implementation.

Parameters

mixed $offset

Return Value

bool

in Resource at line 69
void offsetUnset(mixed $offset)

ArrayAccess implementation.

Parameters

mixed $offset

Return Value

void

in Resource at line 77
mixed offsetGet(mixed $offset)

ArrayAccess implementation.

Parameters

mixed $offset

Return Value

mixed

in Resource at line 90
static string|null emptyToNull(string|null $path)

Infer the default image for Melon as null

Parameters

string|null $path

The path from Melon.

Return Value

string|null

If it is default image, return null.

Examples

https://cdnimg.melon.co.kr/resource/mobile40/cds/common/image/sns_post_default_500.jpg

at line 48
static ArtistResource make(MelonArtist $melonArtist)

Create a new ArtistResource instance.

Parameters

MelonArtist $melonArtist

Return Value

ArtistResource

Examples

$artist = ArtistResource::make($waterMelon->getArtists()[0]);
print $song->title;
print $song->title;
//=> Ditto
print $song->album_id;
//=> 11127145
print $song->artwork_image_path;
//=> https://cdnimg.melon.co.kr/cm2/album/images/111/27/145/11127145_20231213133532_500.jpg?42f8389c13de0f5f8e4c722bbb0d4bd7/melon/resize/144/optimize/90