mxCodecRegistry

A class to register codecs for objects.

Summary
mxCodecRegistryA class to register codecs for objects.
Variables
codecsMaps from constructor names to codecs.
aliasesMaps from classnames to codecnames.
Functions
registerRegisters a new codec and associates the name of the template constructor in the codec with the codec object.
addAliasAdds an alias for mapping a classname to a codecname.
getCodecReturns a codec that handles objects that are constructed using the given ctor.
getInstanceForNameCreates and returns a new instance for the given class name.
getNameReturns the codec name for the given object instance.

Variables

codecs

public static $codecs

Maps from constructor names to codecs.

aliases

public static $aliases

Maps from classnames to codecnames.

Functions

register

static function register($codec)

Registers a new codec and associates the name of the template constructor in the codec with the codec object.  Automatically creates an alias if the codename and the classname are not equal.

Parameters

codecmxObjectCodec to be registered.

addAlias

static function addAlias($classname,
$codecname)

Adds an alias for mapping a classname to a codecname.

getCodec

static function getCodec($name)

Returns a codec that handles objects that are constructed using the given ctor.

Parameters

ctorJavaScript constructor function.

getInstanceForName

static function getInstanceForName($name)

Creates and returns a new instance for the given class name.

getName

static function getName($obj)

Returns the codec name for the given object instance.

Parameters

objPHP object to return the codec name for.
public static $codecs
Maps from constructor names to codecs.
public static $aliases
Maps from classnames to codecnames.
static function register($codec)
Registers a new codec and associates the name of the template constructor in the codec with the codec object.
static function addAlias($classname,
$codecname)
Adds an alias for mapping a classname to a codecname.
static function getCodec($name)
Returns a codec that handles objects that are constructed using the given ctor.
static function getInstanceForName($name)
Creates and returns a new instance for the given class name.
static function getName($obj)
Returns the codec name for the given object instance.
XML codec for PHP object graphs.
Close