\lloc\MslsMslsGetSet

Generic class for overloading properties

Examples

** File not found : https://gist.githubusercontent.com/lloc/2c232cef3f910acf692f/raw/f4eb70f4b1f8dc90c212d85d65af40c6604a32b9/MslsGetSet.php **

Summary

Methods
Properties
Constants
instance()
__set()
__get()
__isset()
__unset()
reset()
has_value()
is_empty()
get_arr()
No public properties found
No constants found
No protected methods found
$arr
N/A
No private methods found
No private properties found
N/A

Properties

$arr

$arr : array

Generic container for all properties of an instance

Type

array

Methods

instance()

instance() : static

Gets or creates an instance of the called class

Returns

static

__set()

__set(string  $key, mixed  $value) 

Overloads the set method.

Parameters

string $key
mixed $value

__get()

__get(string  $key) : mixed

Overloads the get method.

Parameters

string $key

Returns

mixed

__isset()

__isset(string  $key) : boolean

Overloads the isset method.

Parameters

string $key

Returns

boolean

__unset()

__unset(string  $key) 

Overloads the unset method.

Parameters

string $key

reset()

reset() : \lloc\Msls\MslsGetSet

Resets the properties container to an empty array.

Returns

\lloc\Msls\MslsGetSet

has_value()

has_value(string  $key) : boolean

Checks if the array has an non empty item with the specified key name.

This is method is similar to the overloaded isset-method since set cleans empty properties but I use for example

$obj->has_value( $temp )

and not

isset( $obj->$temp )

which is the same but in my opinion a little bit ugly.

Parameters

string $key

Returns

boolean

is_empty()

is_empty() : boolean

Checks if the properties-container is empty.

Returns

boolean

get_arr()

get_arr() : array

Gets the complete properties-container as an array.

Returns

array