Class ConfigXML

Description

Configuration parser for XML based core config

This class takes a XML DOM-tree and transforms it into a internal array representation. It relies on the sat.config.xsd schema you can find in 'phpsatk-lib/data/schema'.

So far a primitive type (<var ...>) is supported as well as a list (<list ...>) type that allows multiple values per variable.

Make sure that your configuration files use the namespace http://sat.eenterphace.org/schema/SAT/config

  1. <config xmlns="http://sat.eenterphace.org/schema/SAT/config">
  2. <var name="somevar1" value="somevalue1" />
  3. <var name="somevar2" value="somevalue2" />
  4. <list name="alist">
  5. <value value="item1" />
  6. <value value="item2" />
  7. <value value="item3" />
  8. </list>
  9. <use virtual="auth.backend" version="1" module="some.module.id" />
  10. </config>

There is also a 'use' (<use ...>) configuration directive that is used for the module manager. It allows binding of specific module to virtual modules. ModuleDB It is processed automatically, when using it make sure the module overlay containing it is already loaded and the virtual role has not been already used.

Located in /phpsatk-lib/core/10.config.xml.php (line 61)


	
			
Method Summary
ConfigXML __construct (mixed $data)
void aggregate (ConfigXML $aggdata)
void dump ()
boolean getBoolean (string $name, [boolean $default = false])
array[string=>mixed] getData ()
string getVar (string $name, [mixed $default = null])
Methods
Constructor __construct (line 78)

Creates a new instance using a DOM-tree or xml data in a string

The configuration data is validated and parsed in this function. Also use directives are processed by passing them to the ModuleDB

  • access: public
ConfigXML __construct (mixed $data)
  • mixed $data: Either an instance of XML (XMLString/XMLFile/XMLSubtree) or a string containing valid xml.
aggregate (line 191)

Merges this part of the configuration with another

Values of the added object overwrite values of this one.

  • access: public
void aggregate (ConfigXML $aggdata)
  • ConfigXML $aggdata: Configuration to aggregate
dump (line 198)

Debuggung function: dumps all values stored in this configuration object

  • access: public
void dump ()
getBoolean (line 155)

Gets a boolean variable

Also evaluates values like 'true', 'yes', 'false', 'no' to boolean states. Includes also a default value which is returned if the variable ist not found.

  • access: public
boolean getBoolean (string $name, [boolean $default = false])
  • string $name: Var name
  • boolean $default: Default state if not present in config
getData (line 180)

Gets the whole array of configuration data

  • access: protected
array[string=>mixed] getData ()
getVar (line 134)

Gets a single var

If the default argument was passed it will be returned if the variable is not present in configuration. If not set, an exception will be thrown.

  • access: public
string getVar (string $name, [mixed $default = null])
  • string $name: Var name
  • mixed $default: Default value to return if not present.

Documentation generated on Mon, 21 May 2007 10:34:34 +0200 by phpDocumentor 1.3.0RC5