SourceForge.net LogoPHPGallue
[ class tree: libbase ] [ index: libbase ] [ all elements ]

Class: GALSection

Source Location: /libbase/config.inc.php

Class Overview


Represents a section of a XML config file, see GALConfig.


Author(s):

Variables

Methods


Child classes:

GALConfig
Used to read and change configuration files.

Class Details

[line 34]
Represents a section of a XML config file, see GALConfig.

It adds, removes, reads and writes values.




Tags:

todo:  Implement some SDL interfaces to iterate over values and subsections (low priority).


[ Top ]


Class Variables

$domSection =

[line 40]



Tags:

var:  A section element inside the config XML ducument.
access:  protected

Type:   DOMElement


[ Top ]



Class Methods


constructor __construct [line 73]

GALSection __construct( $domSection)

Initialize values by reading the section element.

Get all value elements below the given section element and create the corresponding value objects. If there are multiple values with the same name, an Exception is thrown.




Overridden in child classes as:

GALConfig::__construct()
Read values from XML document.

Parameters:

DOMElement   $domSection   The section to evaluate.

[ Top ]

method addSection [line 292]

GALSection addSection( string $name)

Adds a new section to this config.

This method adds a new section with the specified name to the config file, i.e. it creates a new DOMNode in the XML config file.




Tags:

return:  The new section.
throws:  Exception If a section or value with the same name already exists or the specified name is empty.


Parameters:

string   $name   Must not be empty.

[ Top ]

method addValue [line 318]

GALValue addValue( string $name, string $type, string $value)

Adds a new value tho this config.

This method adds a new value with the specified name, type and value to the config file, i.e. it creates a new DOMNode in the XML config file.




Tags:

return:  The new value.
throws:  Exception If a section or value with the same name already exists or the specified name or type is empty.


Parameters:

string   $name   Must not be empty.
string   $type   Must not be empty.
string   $value   I fear it's not binary-safe.

[ Top ]

method getName [line 229]

string getName( )

Returns this section's name.

This method returns the value of this section's "name" attribute.




[ Top ]

method getSections [line 166]

array getSections( )

List all defined section inside the current section.



Tags:

return:  Array of GALSection objects.


[ Top ]

method getValues [line 155]

array getValues( )

List all defined values inside the current section.



Tags:

return:  Array of GALValue objects.


[ Top ]

method merge [line 367]

void merge( GALSection $source)

Merges the given GALSection recursively into this section.

This method recursively adds every subsection and every value which is defined in $source but not in this section. Existing sections and values aren't touched.




Parameters:

GALSection   $source  

[ Top ]

method mountAddSection [line 269]

TRUE mountAddSection( GALSection $section, string $name)

Adds a section from another config.

This method transparently adds a "foreign" section to the configuration tree. It might come from another config tree or from another part of the same config. Think of it as of a symbolic link.




Tags:

return:  On Success.


Parameters:

GALSection   $section   The section to add.
string   $name   The name under which the section can be accessed. Must not be empty.

[ Top ]

method mountReplace [line 238]

void mountReplace( GALSection $section)

Replaces the contents of this section with the new section.

Most method calls are redirected to the replacing section.




Parameters:

GALSection   $section   The replacing section.

[ Top ]

method remove [line 203]

bool remove( $name, string $valueName)

Remove the specified value or section.



Tags:

return:  TRUE if value existed, FALSE if not.


Parameters:

string   $valueName   The name of the value to remove.
   $name  

[ Top ]

method removeFrom [line 124]

DOMText removeFrom( $node)

Deletes the section's tag from the given node.

Internally used when deleting a section. It is public, because it's called in GALConfig::removeSection().




Tags:

return:  The removed section element or false if removing failed.
see:  DOMNode::removeChild()


Parameters:

DOMNode   $node   Usually the config document's main node.

[ Top ]

method sectionExists [line 191]

boolen sectionExists( string $name)

Test if the specified section exists



Parameters:

string   $name   The section's name

[ Top ]

method touchSection [line 338]

GALSection touchSection( string $name)

Adds a section with the given name if a value or section with the given name doesn't exist.



Parameters:

string   $name   The section's name

[ Top ]

method touchValue [line 352]

GALValue touchValue( string $name, [ $type = 'string'], [ $value = ''])

Adds a value with the given name and type if a value or section with the given name doesn't exist.



Parameters:

string   $name   The section's name
   $type  
   $value  

[ Top ]

method umountReplace [line 250]

GALSection umountReplace( )

Removes a replacing section.

If there's a replacing section, this method removes and returns it.




Tags:

return:  If there was no replacing section, it returns FALSE.


[ Top ]

method valueExists [line 179]

boolen valueExists( string $name)

Test if the specified value exists



Parameters:

string   $name   The value's name

[ Top ]

method __get [line 133]

GALValue __get( string $varName)

Magic method to read a value of this section like a property.

If the value doesn't exist, this method throws an GAL_EProperty.




Tags:

return:  the corresponding GALValue object.


Parameters:

string   $varName   The requested value's name.

[ Top ]

method __set [line 148]

void __set( $varName, $section)

Writing sections is not supported.



Tags:

throws:  GAL_EProperty


Parameters:

   $varName  
   $section  

[ Top ]


Documentation generated on Wed, 16 Aug 2006 15:35:35 +0200 by phpDocumentor 1.3.0RC6