Config
[ class tree: Config ] [ index: Config ] [ all elements ]

Class: Config_Container

Source Location: /Config-0.3.1/Config/Container.php

Class Overview


Interface for Config-Classes


Author(s):

Version:

  • $Id: Container.php,v 1.2 2001/12/11 19:45:37 sebastian Exp $

Methods


Child classes:

Config_Container_db
Config-API-Implemtentation for DB-Ini-Entries
Config_Container_IniFile
Config-API-Implemtentation for Ini-Files
Config_Container_phpIniFile
Config-API-Implemtentation for Ini-Files using parse_ini_file
Config_Container_wddx
Config-API-Implemtentation for wddx Files
Config_Container_xml
Config-API-Implemtentation for XML-Files

Inherited Variables

Inherited Methods


Class Details

[line 34]
Interface for Config-Classes

This interface provides a API for configuration data



[ Top ]


Method Detail

getBlocks   [line 109]

array getBlocks( string $block)

returns the name of all childblocks

The implementation returns the name of all childblocks in the given block as a array. If a childblock contains also childblocks the value of the block have to be also a array containing all grandchild-blocks


Parameters:

string   $block     block path

[ Top ]

getValue   [line 129]

mixed getValue( string $block, string $key, [string $default = ""])

returns the value of the key in the given block

The implementation returns the value of the key in the given block. If the key or the block not exist the implementation should return the default-value and create the block with the key and the default-value.


Parameters:

string   $block     block path
string   $key     key
string   $default     default-value

[ Top ]

getValues   [line 90]

array getValues( string $block)

returns all key-value-pairs of the given block

The implementation should returns only the pairs of the given block, no names of subblocks. Blocks should be looks like this "/rootblock/child_block/grandchild_block/..." Take care of the leading slash - this is a "root"-slash according to the "root"-dir under Unix. If a config data source contains no blocks or using of blocks makes no sense the implementation have to support at least the root-slash.

  • Return: returns a hash containing all values, but a PEAR_Error if fails
  • Access: public

Parameters:

string   $block     block path

[ Top ]

parseInput   [line 49]

mixed parseInput( [string $datasrc = ""], [array $feature = array()])

parses the input of the given data source

The format and required content of $datasrc depends of the implementation. If the implemention requires additional data, for example a comment char, it have to deliver in a hash as second argument.

  • Return: returns a PEAR_ERROR, if error occurs
  • Access: public

Overridden in child classes as:

Config_Container_db::parseInput()
parses the input of the given data source
Config_Container_IniFile::parseInput()
parses the input of the given data source
Config_Container_phpIniFile::parseInput()
parses the input of the given data source
Config_Container_wddx::parseInput()
parses the input of the given data source
Config_Container_xml::parseInput()
parses the input of the given data source

Parameters:

string   $datasrc     Name of the datasource to parse
array   $feature     Contains a hash of features depending on the implentation

[ Top ]

setFeatures   [line 163]

void setFeatures( array $requested, array $allowed)

Imports the requested datafields as object variables if allowed

Parameters:

array   $requested     List of fields to be imported as object variables
array   $allowed     List of allowed datafields

[ Top ]

setValue   [line 150]

mixed setValue( string $block, string $key, string $value)

sets the value of the key in the given block

The implementation sets the value of the key in the given block and returns value. If the key or the block not exist, the implementation should create the block with the key and the value.


Parameters:

string   $block     block path
string   $key     key
string   $value     value to set

[ Top ]

writeInput   [line 69]

mixed writeInput( [string $datasrc = ""], [boolean $preserve = true])

writes the data to the given data source or if not given to the datasource of parseInput

See parseInput for $datasrc. If the second argument $preserve is true, the implementation should try to preserve the original format and data of the source except changed or added values. This mean to preserve for example comments in files or so.


Overridden in child classes as:

Config_Container_db::writeInput()
writes the data to the given data source or if not given to the datasource of parseInput If $datasrc was a array, the last file will used.
Config_Container_IniFile::writeInput()
writes the data to the given data source or if not given to the datasource of parseInput If $datasrc was a array, the last file will used.
Config_Container_phpIniFile::writeInput()
Relay for writeInput in Config_Container_IniFile::writeInput(); uses the wonderfull trick of $this being inherited on static method calls
Config_Container_wddx::writeInput()
writes the data to the given data source or if not given to the datasource of parseInput If $datasrc was a array, the last file will used.

Parameters:

string   $datasrc     Name of the datasource to parse
boolean   $preserve     preserving behavior

[ Top ]


Documentation generated on Fri, 30 Apr 2004 21:21:34 +0200 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.