ZenMagick 0.9.10


org.zenmagick.core\ZMObject
core\ZMObject.php at line 36

Class ZMObject

ZMObject

public class ZMObject

ZenMagick base class.

This is the base class for all ZenMagick classes and contains some very basic stuff that might be usefull for most/all classes.

Included is generic support for properties via get($name), set($name, $value) and, via the corresponding methods __get($name) and __set($name,$value).

Author:
DerManoMann

Field Summary
protected mixed

$properties_

Method Summary
void

__construct()

Create new instance.

static void

attachMethod(string method, string className, mixed target)

Attach a dynamic method to objects.

mixed

get(string name, mixed default)

Support to access property values by name.

void

getAttachedMethods(array List)

Get all attached methods for this instance.

array

getProperties()

Get all custom properties.

array

getPropertyNames(boolean customOnly)

Get a list of all properties.

void

set(string name, mixed value)

Support to set property values by name.

protected static mixed

singleton(string name, string instance, boolean force)

Get a singleton instance of the named class.

Field Detail

core\ZMObject.php at line 39

properties_

protected mixed $properties_

Method Detail

core\ZMObject.php at line 45

__construct

public void __construct()

Create new instance.


core\ZMObject.php at line 161

attachMethod

public static void attachMethod(string method, string className, mixed target)

Attach a dynamic method to objects.

Target functions/methods have the following signature: ($ref, ...). $ref is the current instance ($this), and the remaining arguments are the actual call parameter.

Parameters:
method - The method name.
className - Name of the class to allow the method.
target - The target function or method.

core\ZMObject.php at line 84

get

public mixed get(string name, mixed default)

Support to access property values by name.

Parameters:
name - The property name.
default - A default value; default value is null.
Returns:
The value or null.

core\ZMObject.php at line 173

getAttachedMethods

public void getAttachedMethods(array List)

Get all attached methods for this instance.

Parameters:
List - of attached method names.

core\ZMObject.php at line 147

getProperties

public array getProperties()

Get all custom properties.

Returns:
Map of properties.

core\ZMObject.php at line 134

getPropertyNames

public array getPropertyNames(boolean customOnly)

Get a list of all properties.

Parameters:
customOnly - If set, consider only custom properties; default is true.
Returns:
List of custom properties set on this object.

core\ZMObject.php at line 124

set

public void set(string name, mixed value)

Support to set property values by name.

Parameters:
name - The property name.
value - The value.

core\ZMObject.php at line 64

singleton

protected static mixed singleton(string name, string instance, boolean force)

Get a singleton instance of the named class.

Parameters:
name - The class name.
instance - If set, register the given object, unless the name is already taken.
force - Optional flag to force replacement.
Returns:
A singleton object.

ZenMagick 0.9.10