zObject

A zObject is basicaly an associative array (map) with public accessors accepting keys in path format, that is, nested keys delimited by a slash. That makes it very easy to costruct and access tree-like structures. This is, in fact, happening all over the place in zoglair.

zObject publishes quite a few static path handling funcs and other helpers. Although not all of them are needed by its accessors, they are included for the sake of completeness.

It should be noted that system zoglair classes must be instantiated via its factory method zoglair::load_plugin() and not directly. The factory does a lot more than simply calling “new”. The $singleton default argument (and the surrounding mechanism) is kind of a hack, but unfortunately cannot be done in an academic fashion. The constructor has to be inheritable and PHP does not permit it unless it is public.

Converts an array to a human readable *.ini-like string. This function is recursive, so it can handle nested keys for tree-like maps, such as a zObject's properties. The array is sorted (by key order) before processing.

A universal, high usage frequency, object accessor. Used for getting the value of any object property (existing or not). Remember that properties are stored in a tree map, so the info passed can be a path.

Parameters

• The name (or path) of the requested property, eg: “name”, “name1/.../nameN”, etc

A smart, polymorphic, method that gives the singleton capability to any derivative class. So, the class tree is kept plain and easy! No need to call it explicitly: zoglair::load_plugin() calls it on a need-to-use basis.

A universal, high usage frequency, object mutator. Used for setting the value of any object property (existing or not). Remember that properties are stored in a tree map, so the info passed can be a path.

Parameters

• The name (or path) of the requested property, eg: “name”, “name1/.../nameN”, etc