Create
Generic object creator which follows the PEAR directory standard. Note that the class' constructor should only accept 1 parameter.
object
&create
([mixed $options = null], [string $class = __CLASS__])
-
mixed
$options: Class' construction parameter.
-
string
$class: Class' full name, eg: Gadget_Tree_XML
Redefined in descendants as:
Dump
Prints the string representation of the tree.
void
dump
([array $options = array()])
-
array
$options: Serializer options
Factory
Gadget_Tree factory.
object Returns
&factory
([string $type = null], [mixed $options = array()])
fputs
mixed
fputs
(mixed $file, string $contents)
-
string
$contents: File contents
From
Set the tree from an Gadget_Tree_Node object.
void
&from
(mixed &$from, [array $testFrom = array()])
-
mixed
$from
-
array
$testFrom
From Node
Set the tree from an Gadget_Tree_Node object.
mixed
&fromNode
(object &$node)
-
object
$node: The root Gadget_Tree_Node object.
Is Error
bool
isError
(mixed $error)
Raise Error
Raises a PEAR_Error.
object PEAR_Error
&raiseError
(string $error, int $code)
-
string
$error: The error message.
-
int
$code: The error code.
Search By Path
mixed
&searchByPath
(mixed $path, [mixed $pathSeparator = '/'])
Serialize
string
serialize
(
object Gadget_Tree &$tree, [
array $options =
array()], [
mixed $serializer =
'Gadget_Tree_Serializer'],
string $serilaizer)
-
object Gadget_Tree
$tree
-
array
$options: Serializer options
-
string
$serilaizer: Gadget_Tree_Serializer class
Redefined in descendants as:
To Array
array
&toArray
()
To File
Save the tree to an file. The output is specific to the tree class.
mixed
toFile
(string $file, [array $options = array()])
-
string
$file: The path of the destination file.
-
array
$options: Serializer options
Redefined in descendants as:
To String
string
toString
([array $options = array()])
-
array
$options: Serializer options
Redefined in descendants as:
Unfold
Unfolds an array of nodes to a flat array.
void
unfold
(array &$tree, array &$into)
-
array
$tree: The array of Gadget_Tree_Node objects.
-
array
$into: The flat array of the tree nodes.
Unfold Tree
Unfolds a Gadget_Tree object to a flat array.
array
&unfoldTree
(object &$tree)
-
object
$tree: The Gadget_Tree object to unfold.
Walk along a Link
-
object Gadget_Tree_Node
$node: The starting node.
-
string
$link: The literal link name.
-
bool
$withFirstNode: Whether the first node should be included.
Inherited Methods
Inherited From Gadget_Object
Gadget_Object::Gadget_Object()
Gadget_Object::onAfterConstruct()
Gadget_Object::onBeforeConstruct()
Gadget_Object::setOptions()