Since: 2023-03-20

abstract class Resource implements ArrayAccess

Resource class for general melon resources.

Properties

Melon $melon
protected array $container

Methods

array
toArray()

To get resource as array.

__construct(Melon $melon)

Constructor.

mixed
__get(mixed $name)

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

void
offsetSet(mixed $offset, mixed $value)

ArrayAccess implementation.

bool
offsetExists(mixed $offset)

ArrayAccess implementation.

void
offsetUnset(mixed $offset)

ArrayAccess implementation.

mixed
offsetGet(mixed $offset)

ArrayAccess implementation.

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

Infer the default image for Melon as null

Details

at line 24
abstract protected array toArray()

To get resource as array.

Return Value

array

at line 31
__construct(Melon $melon)

Constructor.

Parameters

Melon $melon

Melon class instance

at line 41
mixed __get(mixed $name)

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

Parameters

mixed $name

Return Value

mixed

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

ArrayAccess implementation.

Parameters

mixed $offset
mixed $value

Return Value

void

at line 61
bool offsetExists(mixed $offset)

ArrayAccess implementation.

Parameters

mixed $offset

Return Value

bool

at line 69
void offsetUnset(mixed $offset)

ArrayAccess implementation.

Parameters

mixed $offset

Return Value

void

at line 77
mixed offsetGet(mixed $offset)

ArrayAccess implementation.

Parameters

mixed $offset

Return Value

mixed

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