Class: Config_Container
Source Location: /Config-1.10.4/Config/Container.php
Interface for Config containers
Author(s):
|
|
|
Child classes:
|
Inherited Variables
|
Inherited Methods
|
Class Details
Class Variables
Method Detail
Config_Container (Constructor) [line 85]
Config_Container Config_Container(
[string
$type = 'section'], [string
$name = ''], [string
$content = ''], [array
$attributes = null])
|
|
Constructor
Parameters:
addItem [line 119]
mixed &addItem(
object
&$item, [string
$where = 'bottom'], [object
$target = null])
|
|
Adds an item to this item.
Parameters:
countChildren [line 396]
int countChildren(
[string
$type = null], [string
$name = null])
|
|
Returns how many children this container has
Parameters:
createBlank [line 178]
object reference &createBlank(
[mixed
$where = 'bottom'], [mixed
$target = null])
|
|
Adds a blank line to this item. This is a helper method that calls createItem
createComment [line 167]
object reference &createComment(
[string
$content = ''], [string
$where = 'bottom'], [object
$target = null])
|
|
Adds a comment to this item. This is a helper method that calls createItem
Parameters:
createDirective [line 194]
object reference &createDirective(
string
$name, string
$content, [mixed
$attributes = null], [string
$where = 'bottom'], [object
$target = null])
|
|
Adds a directive to this item. This is a helper method that calls createItem
Parameters:
createItem [line 105]
object reference &createItem(
string
$type, mixed
$name, string
$content, [array
$attributes = null], [string
$where = 'bottom'], [object
$target = null], mixed
$item)
|
|
Create a child for this item.
Parameters:
createSection [line 212]
object reference &createSection(
string
$name, [array
$attributes = null], [string
$where = 'bottom'], [object
$target = null])
|
|
Adds a section to this item. This is a helper method that calls createItem If the section already exists, it won't create a new one. It will return reference to existing item.
Parameters:
directiveContent [line 376]
mixed directiveContent(
mixed
$args, [int
$index = -1])
|
|
Return a child directive's content. This method can use two different search approach, depending on the parameter it is given. If the parameter is an array, it will use the Config_Container::searchPath() method. If it is a string, it will use the Config_Container::getItem() method. Example: 1 require_once 'Config.php'; 2 $ini = new Config(); 3 $conf =& $ini->parseConfig('/path/to/config.ini', 'inicommented'); 4 5 // Will return the value found at : 6 // [Database] 7 // host=localhost 8 echo $conf->directiveContent(array('Database', 'host'))); 9 10 // Will return the value found at : 11 // date="dec-2004" 12 echo $conf->directiveContent('date');
Parameters:
getAttribute [line 604]
mixed getAttribute(
string
$attribute)
|
|
Get one attribute value of this item
Parameters:
getAttributes [line 594]
Get this item's attributes.
getChild [line 503]
mixed &getChild(
[mixed
$index = 0])
|
|
Returns the item parent object.
getContent [line 543]
getItem [line 238]
mixed &getItem(
[string
$type = null], [mixed
$name = null], [mixed
$content = null], [array
$attributes = null], [int
$index = -1])
|
|
Tries to find the specified item(s) and returns the objects. Examples: $directives =& $obj->getItem('directive'); $directive_bar_4 =& $obj->getItem('directive', 'bar', null, 4); $section_foo =& $obj->getItem('section', 'foo'); This method can only be called on an object of type 'section'. Note that root is a section. This method is not recursive and tries to keep the current structure. For a deeper search, use searchPath()
Parameters:
getItemIndex [line 452]
Returns the item index in its parent children array.
getItemPosition [line 471]
Returns the item rank in its parent children array according to other items with same type and name.
getName [line 525]
getParent [line 494]
object returns &getParent(
)
|
|
Returns the item parent object.
getType [line 561]
isRoot [line 642]
Is this item root, in a config container object
removeItem [line 435]
Deletes an item (section, directive, comment...) from the current object TODO: recursive remove in sub-sections
searchPath [line 317]
mixed &searchPath(
mixed
$args)
|
|
Finds a node using XPATH like format. The search format is an array: array(item1, item2, item3, ...) Each item can be defined as the following: item = 'string' : will match the container named 'string' item = array('string', array('name' => 'xyz')) will match the container name 'string' whose attribute name is equal to "xyz" For example : <string name="xyz">
Parameters:
setAttributes [line 571]
void setAttributes(
array
$attributes)
|
|
Set this item's attributes.
Parameters:
setContent [line 534]
void setContent(
mixed
$content)
|
|
Set this item's content.
setDirective [line 624]
object newly &setDirective(
string
$name, mixed
$content, [int
$index = -1])
|
|
Set a children directive content. This is an helper method calling getItem and addItem or setContent for you. If the directive does not exist, it will be created at the bottom.
Parameters:
setName [line 516]
void setName(
mixed
$name)
|
|
Set this item's name.
setType [line 552]
void setType(
mixed
$type)
|
|
Set this item's type.
toArray [line 679]
array toArray(
[bool
$useAttr = true])
|
|
Returns a key/value pair array of the container and its children. Format : section[directive][index] = value If the container has attributes, it will use '@' and '#' index is here because multiple directives can have the same name.
Parameters:
toString [line 656]
mixed toString(
string
$configType, [array
$options = array()])
|
|
Call the toString methods in the container plugin
Overridden in child classes as:
- Config_Container_PHPConstants::toString()
- Returns a formatted string of the object
Parameters:
updateAttributes [line 581]
void updateAttributes(
array
$attributes)
|
|
Set this item's attributes.
Parameters:
writeDatasrc [line 732]
mixed writeDatasrc(
mixed
$datasrc, string
$configType, [array
$options = array()])
|
|
Writes the configuration to a file
Overridden in child classes as:
- Config_Container_PHPConstants::writeDatasrc()
- Writes the configuration to a file
Parameters:
Documentation generated on Sat, 12 Feb 2005 14:20:13 -0500 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.
|
|