Class: I2CE MagicData: Difference between revisions

From IHRIS Wiki
No edit summary
No edit summary
Line 2: Line 2:
*Extends the class: [[Class: I2CE_MagicDataNode | I2CE_MagicDataNode]].
*Extends the class: [[Class: I2CE_MagicDataNode | I2CE_MagicDataNode]].
*Location: Part of the module [[I2CE Module List#I2CE|I2CE]] in the package [https://launchpad.net/i2ce I2CE]
*Location: Part of the module [[I2CE Module List#I2CE|I2CE]] in the package [https://launchpad.net/i2ce I2CE]
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.1-release/annotate/head:/lib/I2CE_MagicData.php lib/I2CE_MagicData.php]
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/lib/I2CE_MagicData.php#L35 lib/I2CE_MagicData.php] on line 35
Configuration class to lookup and save configuration options.
Configuration class to lookup and save configuration options.
==Variables==
==Variables==
===$instances===
===$instances===
A list of named instances of this class.
A list of named instances of this class.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/lib/I2CE_MagicData.php#L40 i2ce/lib/I2CE_MagicData.php] on line 40
*Type: static protected [http://www.php.net/manual/en/language.types.array.php array ] $instances
*Type: static protected [http://www.php.net/manual/en/language.types.array.php array ] $instances


===$last_instance===
===$last_instance===
The index of the last accessed stored instance of this class
The index of the last accessed stored instance of this class
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/lib/I2CE_MagicData.php#L44 i2ce/lib/I2CE_MagicData.php] on line 44
*Type: static protected [http://www.php.net/manual/en/language.types.string.php string ] $last_instance
*Type: static protected [http://www.php.net/manual/en/language.types.string.php string ] $last_instance


===$instance===
===$instance===
The instance index for this configuration grouping.
The instance index for this configuration grouping.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/lib/I2CE_MagicData.php#L48 i2ce/lib/I2CE_MagicData.php] on line 48
*Type: protected [http://www.php.net/manual/en/language.types.string.php string ] $instance
*Type: protected [http://www.php.net/manual/en/language.types.string.php string ] $instance


===$storage===
===$storage===
A list of storage objects to use to store and retrieve values. Values will be saved using all storage objects and retrieved until a match is found in the order the objects are assigned.
A list of storage objects to use to store and retrieve values. Values will be saved using all storage objects and retrieved until a match is found in the order the objects are assigned.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/lib/I2CE_MagicData.php#L56 i2ce/lib/I2CE_MagicData.php] on line 56
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $storage
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $storage


===$num_storage===
===$num_storage===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/lib/I2CE_MagicData.php#L279 i2ce/lib/I2CE_MagicData.php] on line 279
*Type: protected $num_storage
*Type: protected $num_storage


===$locales===
===$locales===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/lib/I2CE_MagicData.php#L280 i2ce/lib/I2CE_MagicData.php] on line 280
*Type: protected $locales
*Type: protected $locales


Line 30: Line 36:
===__construct()===
===__construct()===
Construct a new configuration value or grouping.
Construct a new configuration value or grouping.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/lib/I2CE_MagicData.php#L288 i2ce/lib/I2CE_MagicData.php] on line 288
*Signature: protected function __construct($name,$parent,$check_key)
*Signature: protected function __construct($name,$parent,$check_key)
*Parameters:
*Parameters:
Line 40: Line 47:
===addStorage()===
===addStorage()===
Add the given storage object to this instance. The last one added is considered to be the "definitive" one -- the one whose contents should be considered correct.  The first one added should be the one which has quickest access
Add the given storage object to this instance. The last one added is considered to be the "definitive" one -- the one whose contents should be considered correct.  The first one added should be the one which has quickest access
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/lib/I2CE_MagicData.php#L249 i2ce/lib/I2CE_MagicData.php] on line 249
*Signature: public function addStorage($storage)
*Signature: public function addStorage($storage)
*Parameters:
*Parameters:
Line 45: Line 53:
===clearCache()===
===clearCache()===
Clear caching for each of the storage mechanisms @param  I2CE_MagicDataNode $node. The node we wish to remove from the cache.  If null ( default) we call the clear() method for all but the last added storage mecahnism.  If non-null, we call the destory() method for the node on all but the last storage mechanism.
Clear caching for each of the storage mechanisms @param  I2CE_MagicDataNode $node. The node we wish to remove from the cache.  If null ( default) we call the clear() method for all but the last added storage mecahnism.  If non-null, we call the destory() method for the node on all but the last storage mechanism.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/lib/I2CE_MagicData.php#L188 i2ce/lib/I2CE_MagicData.php] on line 188
*Signature: public function clearCache()
*Signature: public function clearCache()
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===destroy()===
===destroy()===
Destroy the specified node from each of the storage mechanisms
Destroy the specified node from each of the storage mechanisms
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/lib/I2CE_MagicData.php#L169 i2ce/lib/I2CE_MagicData.php] on line 169
*Signature: public function destroy($node)
*Signature: public function destroy($node)
*Parameters:
*Parameters:
Line 55: Line 65:
===getPath()===
===getPath()===
Return the full path to this configuration setting.
Return the full path to this configuration setting.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/lib/I2CE_MagicData.php#L116 i2ce/lib/I2CE_MagicData.php] on line 116
*Signature: public function getPath($show_top)
*Signature: public function getPath($show_top)
*Parameters:
*Parameters:
Line 62: Line 73:
===getPermanentStorageClass()===
===getPermanentStorageClass()===
Gets the class of the permanent storage object (the last one added)
Gets the class of the permanent storage object (the last one added)
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/lib/I2CE_MagicData.php#L273 i2ce/lib/I2CE_MagicData.php] on line 273
*Signature: public function getPermanentStorageClass()
*Signature: public function getPermanentStorageClass()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===instance()===
===instance()===
Return an instance of this class based on the index given. This will create the instance if it doesn't exist.
Return an instance of this class based on the index given. This will create the instance if it doesn't exist.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/lib/I2CE_MagicData.php#L67 i2ce/lib/I2CE_MagicData.php] on line 67
*Signature: static public function instance($index,$replace)
*Signature: static public function instance($index,$replace)
*Parameters:
*Parameters:
Line 75: Line 88:
===pathDivider()===
===pathDivider()===
Return the path divider for this MagicDataNode object
Return the path divider for this MagicDataNode object
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/lib/I2CE_MagicData.php#L109 i2ce/lib/I2CE_MagicData.php] on line 109
*Signature: protected function pathDivider()
*Signature: protected function pathDivider()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===retrieve()===
===retrieve()===
Retrieve the given magic data node (which should be a descendent of this instance.)
Retrieve the given magic data node (which should be a descendent of this instance.)
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/lib/I2CE_MagicData.php#L205 i2ce/lib/I2CE_MagicData.php] on line 205
*Signature: public function retrieve($node)
*Signature: public function retrieve($node)
*Parameters:
*Parameters:
Line 84: Line 99:
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]
===setLocales()===
===setLocales()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/lib/I2CE_MagicData.php#L295 i2ce/lib/I2CE_MagicData.php] on line 295
*Signature: public function setLocales($locales)
*Signature: public function setLocales($locales)
*Parameters:
*Parameters:
Line 89: Line 105:
===store()===
===store()===
Store the given magic data node (which should be a descendent of this instance.)  Starts storing at the last added storage mechanism until it reaches the first storage mechanism.  If it fails saving at any storage mechanis, it will call the destroy method on that storage mechanism and any remaining one.
Store the given magic data node (which should be a descendent of this instance.)  Starts storing at the last added storage mechanism until it reaches the first storage mechanism.  If it fails saving at any storage mechanis, it will call the destroy method on that storage mechanism and any remaining one.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/lib/I2CE_MagicData.php#L137 i2ce/lib/I2CE_MagicData.php] on line 137
*Signature: public function store($node,$max)
*Signature: public function store($node,$max)
*Parameters:
*Parameters:
Line 97: Line 114:
===tearDown()===
===tearDown()===
Clean up all MagicData instances.  Normally, this should not be used.  Primarily for unit testing.
Clean up all MagicData instances.  Normally, this should not be used.  Primarily for unit testing.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/lib/I2CE_MagicData.php#L94 i2ce/lib/I2CE_MagicData.php] on line 94
*Signature: static public function tearDown()
*Signature: static public function tearDown()
==Inherited Methods==
==Inherited Methods==

Revision as of 09:50, 10 November 2009

This article describes the class I2CE_MagicData.

Configuration class to lookup and save configuration options.

Variables

$instances

A list of named instances of this class.

$last_instance

The index of the last accessed stored instance of this class

$instance

The instance index for this configuration grouping.

$storage

A list of storage objects to use to store and retrieve values. Values will be saved using all storage objects and retrieved until a match is found in the order the objects are assigned.

$num_storage

$locales

Methods

__construct()

Construct a new configuration value or grouping.

  • Defined in i2ce/lib/I2CE_MagicData.php on line 288
  • Signature: protected function __construct($name,$parent,$check_key)
  • Parameters:
    • string $name
      The name of this configuration setting.
      • Default Value: null
    • I2CE_MagicDataNode $parent
      The parent of this configuration setting.
      • Default Value: null
    • boolean $check_key
      Defaults to true in which case we check that the key is valid.
      • Default Value: true

addStorage()

Add the given storage object to this instance. The last one added is considered to be the "definitive" one -- the one whose contents should be considered correct. The first one added should be the one which has quickest access

clearCache()

Clear caching for each of the storage mechanisms @param I2CE_MagicDataNode $node. The node we wish to remove from the cache. If null ( default) we call the clear() method for all but the last added storage mecahnism. If non-null, we call the destory() method for the node on all but the last storage mechanism.

destroy()

Destroy the specified node from each of the storage mechanisms

getPath()

Return the full path to this configuration setting.

getPermanentStorageClass()

Gets the class of the permanent storage object (the last one added)

instance()

Return an instance of this class based on the index given. This will create the instance if it doesn't exist.

  • Defined in i2ce/lib/I2CE_MagicData.php on line 67
  • Signature: static public function instance($index,$replace)
  • Parameters:
    • string $index
      • Default Value: NULL
    • boolean $replace
      Defaults to false. If true and $index is non null, then we create a new instance at $index.
      • Default Value: FALSE
  • Returns: I2CE_MagicData

pathDivider()

Return the path divider for this MagicDataNode object

retrieve()

Retrieve the given magic data node (which should be a descendent of this instance.)

setLocales()

store()

Store the given magic data node (which should be a descendent of this instance.) Starts storing at the last added storage mechanism until it reaches the first storage mechanism. If it fails saving at any storage mechanis, it will call the destroy method on that storage mechanism and any remaining one.

  • Defined in i2ce/lib/I2CE_MagicData.php on line 137
  • Signature: public function store($node,$max)
  • Parameters:
    • I2CE_MagicDataNode $node
    • integer $max
      The max index of storage objects to save. Defaults to -1 meaning we store on all mechanisms
      • Default Value: -1
  • Returns: boolean
    true on success.

tearDown()

Clean up all MagicData instances. Normally, this should not be used. Primarily for unit testing.

Inherited Methods

__get()

This public method is inherited from I2CE_MagicDataNode->__get()

__isset()

This public method is inherited from I2CE_MagicDataNode->__isset()

__set()

This public method is inherited from I2CE_MagicDataNode->__set()

__toString()

This public method is inherited from I2CE_MagicDataNode->__toString()

__unset()

This public method is inherited from I2CE_MagicDataNode->__unset()

checkKey()

This public method is inherited from I2CE_MagicDataNode->checkKey()

count()

This public method is inherited from I2CE_MagicDataNode->count()

current()

This public method is inherited from I2CE_MagicDataNode->current()

erase()

This public method is inherited from I2CE_MagicDataNode->erase()

eraseChildren()

This public method is inherited from I2CE_MagicDataNode->eraseChildren()

getAsArray()

This public method is inherited from I2CE_MagicDataNode->getAsArray()

getAttribute()

This public method is inherited from I2CE_MagicDataNode->getAttribute()

getAttributes()

This public method is inherited from I2CE_MagicDataNode->getAttributes()

getChildren()

This public method is inherited from I2CE_MagicDataNode->getChildren()

getKeys()

This public method is inherited from I2CE_MagicDataNode->getKeys()

getName()

This public method is inherited from I2CE_MagicDataNode->getName()

getParent()

This public method is inherited from I2CE_MagicDataNode->getParent()

getSaveValue()

This public method is inherited from I2CE_MagicDataNode->getSaveValue()

getTranslation()

This public method is inherited from I2CE_MagicDataNode->getTranslation()

getTranslations()

This public method is inherited from I2CE_MagicDataNode->getTranslations()

getType()

This public method is inherited from I2CE_MagicDataNode->getType()

getValue()

This public method is inherited from I2CE_MagicDataNode->getValue()

hasAttribute()

This public method is inherited from I2CE_MagicDataNode->hasAttribute()

hasChildren()

This public method is inherited from I2CE_MagicDataNode->hasChildren()

is_indeterminate()

This public method is inherited from I2CE_MagicDataNode->is_indeterminate()

is_parent()

This public method is inherited from I2CE_MagicDataNode->is_parent()

is_root()

This public method is inherited from I2CE_MagicDataNode->is_root()

is_scalar()

This public method is inherited from I2CE_MagicDataNode->is_scalar()

is_translatable()

This public method is inherited from I2CE_MagicDataNode->is_translatable()

is_translated()

This public method is inherited from I2CE_MagicDataNode->is_translated()

key()

This public method is inherited from I2CE_MagicDataNode->key()

krsort()

This public method is inherited from I2CE_MagicDataNode->krsort()

ksort()

This public method is inherited from I2CE_MagicDataNode->ksort()

next()

This public method is inherited from I2CE_MagicDataNode->next()

offsetExists()

This public method is inherited from I2CE_MagicDataNode->offsetExists()

offsetGet()

This public method is inherited from I2CE_MagicDataNode->offsetGet()

offsetSet()

This public method is inherited from I2CE_MagicDataNode->offsetSet()

offsetUnset()

This public method is inherited from I2CE_MagicDataNode->offsetUnset()

pathExists()

This public method is inherited from I2CE_MagicDataNode->pathExists()

pop()

This public method is inherited from I2CE_MagicDataNode->pop()

push()

This public method is inherited from I2CE_MagicDataNode->push()

raiseError()

This public method is inherited from I2CE_MagicDataNode->raiseError()

removeAttribute()

This public method is inherited from I2CE_MagicDataNode->removeAttribute()

removeTranslation()

This public method is inherited from I2CE_MagicDataNode->removeTranslation()

rewind()

This public method is inherited from I2CE_MagicDataNode->rewind()

setAttribute()

This public method is inherited from I2CE_MagicDataNode->setAttribute()

setIfIsSet()

This public method is inherited from I2CE_MagicDataNode->setIfIsSet()

setTranslatable()

This public method is inherited from I2CE_MagicDataNode->setTranslatable()

setTranslation()

This public method is inherited from I2CE_MagicDataNode->setTranslation()

setValue()

This public method is inherited from I2CE_MagicDataNode->setValue()

set_parent()

This public method is inherited from I2CE_MagicDataNode->set_parent()

set_scalar()

This public method is inherited from I2CE_MagicDataNode->set_scalar()

traverse()

This public method is inherited from I2CE_MagicDataNode->traverse()

uksort()

This public method is inherited from I2CE_MagicDataNode->uksort()

unpopulate()

This public method is inherited from I2CE_MagicDataNode->unpopulate()

valid()

This public method is inherited from I2CE_MagicDataNode->valid()

volatile()

This public method is inherited from I2CE_MagicDataNode->volatile()

_getAsArray()

This protected method is inherited from I2CE_MagicDataNode->_getAsArray()

_getAttribute()

This protected method is inherited from I2CE_MagicDataNode->_getAttribute()

_getAttributes()

This protected method is inherited from I2CE_MagicDataNode->_getAttributes()

_hasAttribute()

This protected method is inherited from I2CE_MagicDataNode->_hasAttribute()

_removeAttribute()

This protected method is inherited from I2CE_MagicDataNode->_removeAttribute()

_setAttribute()

This protected method is inherited from I2CE_MagicDataNode->_setAttribute()

is_populated()

This protected method is inherited from I2CE_MagicDataNode->is_populated()

newAttribute()

This protected method is inherited from I2CE_MagicDataNode->newAttribute()

newChild()

This protected method is inherited from I2CE_MagicDataNode->newChild()

populate()

This protected method is inherited from I2CE_MagicDataNode->populate()

save()

This protected method is inherited from I2CE_MagicDataNode->save()

setType()

This protected method is inherited from I2CE_MagicDataNode->setType()

Inherited Variables

$type

Theis protected variable is inherited from I2CE_MagicDataNode->$type

$name

Theis protected variable is inherited from I2CE_MagicDataNode->$name

$value

Theis protected variable is inherited from I2CE_MagicDataNode->$value

$children

Theis protected variable is inherited from I2CE_MagicDataNode->$children

$parent

Theis protected variable is inherited from I2CE_MagicDataNode->$parent

$parentPath

Theis protected variable is inherited from I2CE_MagicDataNode->$parentPath

$parentPathTop

Theis protected variable is inherited from I2CE_MagicDataNode->$parentPathTop

$top

Theis protected variable is inherited from I2CE_MagicDataNode->$top

$volatile

Theis protected variable is inherited from I2CE_MagicDataNode->$volatile

$attributes

Theis protected variable is inherited from I2CE_MagicDataNode->$attributes