Gumbo_Leaf
Gumbo_Tree | --Gumbo_Leaf
Composite Pattern Leaf Class
This class holds a single value (primitive type). It is only responsible for this data. It is the smallest element of the Tree, which means that no additional Branches can be added.
To retrieve the value of a Leaf, simply use the 'get' method, or by using the overload method with any string (except 'name'):
// the following will return the value $leaf->getValue (); $leaf->get (); $leaf->value; $leaf->some_other_string_not_name; // to get the name $leaf->getName (); $leaf->get ("name"); $leaf->name;
Author(s): |
Michael Luster <mluster79@yahoo.com> |
License: | New BSD License |
Copyright: | Copyright (c) 2007, iBayou, Michael Luster |
Link: | http://sourceforge.net/projects/phpgumbo |
Version: | 0.0.1 |
Inherited Methods
- Gumbo_Tree::addAttribute()
- Gumbo_Tree::addComment()
- Gumbo_Tree::getAttribute()
- Gumbo_Tree::getAttributes()
- Gumbo_Tree::getComments()
- Gumbo_Tree::getName()
- Gumbo_Tree::getValue()
- Gumbo_Tree::removeAttribute()
- Gumbo_Tree::resetComments()
- Gumbo_Tree::setName()
- Gumbo_Tree::setValue()
Class Methods
Constructor, Creates new Leaf
Parameter(s):
- (mix) $val :: value of Leaf
- (int|string) $name :: name of Leaf
[ Top ]
Adds a Composite object to the Composite (for Branch use only) (method does nothing)
Parameter(s):
- (Gumbo_Interface_Composite) $tree
- (bool) $replace :: replaces the original Composite object
[ Top ]
Returns the corresponding Composite object or value (use 'name' for the Composite Name)
Parameter(s):
- (int|string) $name
[ Top ]
Removes a Composite object based on the Composite name (for Branch use only) (method does nothing)
Parameter(s):
- (int|string) $name
[ Top ]
Returns the value of the given element
The parameter can either be the actual name of the Leaf object, or the actual property needed to be accessed ("name", "value"). Problems can occur if the $name of the Leaf actually is "name". Use getName () or getValue () for more specific access to values.
Parameter(s):
- (int|string) $name :: use 'name' to get the name or any string to retrieve the value
[ Top ]