Class Gadget_Tree

Description

Gadget_Tree

  • since: 1.0

Located in /Gadget/Tree.php (line 55)

Gadget_Object
   |
   --Gadget_Tree
Direct descendents
Class Description
Gadget_Tree_FS Gadget_Tree_FS
Gadget_Tree_Menu Gadget_Tree_Menu
Gadget_Tree_XML Gadget_Tree_XML
Variable Summary
int $maxDepth
mixed $node
mixed $root
Method Summary
object &create ([mixed $options = null], [string $class = __CLASS__])
void dump ([array $options = array()])
object Returns &factory ([string $type = null], [mixed $options = array()])
mixed fputs (mixed $file, string $contents)
void &from (mixed &$from, [array $testFrom = array()])
mixed &fromNode (object &$node)
bool isError (mixed $error)
object PEAR_Error &raiseError (string $error, int $code)
mixed &searchByPath (mixed $path, [mixed $pathSeparator = '/'])
string serialize (object Gadget_Tree &$tree, [array $options = array()], [mixed $serializer = 'Gadget_Tree_Serializer'], string $serilaizer)
array &toArray ()
mixed toFile (string $file, [array $options = array()])
string toString ([array $options = array()])
void unfold (array &$tree, array &$into)
array &unfoldTree (object &$tree)
array &walkLink (object Gadget_Tree_Node &$node, string $link, [bool $withFirstNode = false])
Variables
int $maxDepth = -1 (line 73)

Max Depth

The maximum depth of the tree. Set to 0 if the tree should only consist of the root node. Set to -1 for infinite depth (default).

mixed $node (line 62)
  • access: protected
mixed $root (line 61)
  • access: protected
Methods
create (line 102)

Create

Generic object creator which follows the PEAR directory standard. Note that the class' constructor should only accept 1 parameter.

  • access: public
  • static:
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 (line 250)

Dump

Prints the string representation of the tree.

  • access: public
void dump ([array $options = array()])
  • array $options: Serializer options
factory (line 84)

Factory

Gadget_Tree factory.

  • return: Gadget_Tree on success or PEAR_Error on failure.
  • access: public
object Returns &factory ([string $type = null], [mixed $options = array()])
  • string $type
fputs (line 301)

fputs

  • return: Returns true on success or a PEAR_Error on failure.
  • access: protected
  • static:
mixed fputs (mixed $file, string $contents)
  • string $contents: File contents
from (line 207)

From

Set the tree from an Gadget_Tree_Node object.

  • access: protected
void &from (mixed &$from, [array $testFrom = array()])
  • mixed $from
  • array $testFrom
fromNode (line 233)

From Node

Set the tree from an Gadget_Tree_Node object.

  • return: Returns the root node if $node is_a() Gadget_Tree_Node.
  • access: public
mixed &fromNode (object &$node)
  • object $node: The root Gadget_Tree_Node object.
isError (line 156)

Is Error

  • access: public
bool isError (mixed $error)
raiseError (line 144)

Raise Error

Raises a PEAR_Error.

  • access: protected
object PEAR_Error &raiseError (string $error, int $code)
  • string $error: The error message.
  • int $code: The error code.
searchByPath (line 351)

Search By Path

  • access: public
  • todo: implement
mixed &searchByPath (mixed $path, [mixed $pathSeparator = '/'])
serialize (line 125)

Serialize

  • access: public
  • static:
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:
toArray (line 261)

To Array

  • access: public
array &toArray ()
toFile (line 276)

To File

Save the tree to an file. The output is specific to the tree class.

  • return: Returns true on success or a PEAR_Error on failure.
  • access: public
mixed toFile (string $file, [array $options = array()])
  • string $file: The path of the destination file.
  • array $options: Serializer options

Redefined in descendants as:
toString (line 288)

To String

  • access: public
string toString ([array $options = array()])
  • array $options: Serializer options

Redefined in descendants as:
unfold (line 188)

Unfold

Unfolds an array of nodes to a flat array.

  • access: public
  • static:
void unfold (array &$tree, array &$into)
  • array $tree: The array of Gadget_Tree_Node objects.
  • array $into: The flat array of the tree nodes.
unfoldTree (line 171)

Unfold Tree

Unfolds a Gadget_Tree object to a flat array.

  • return: Returns the flat array (1 dimension).
  • access: public
  • static:
array &unfoldTree (object &$tree)
  • object $tree: The Gadget_Tree object to unfold.
walkLink (line 335)

Walk along a Link

  • return: Flat array with all nodes along the link.
  • access: public
  • static:
array &walkLink (object Gadget_Tree_Node &$node, string $link, [bool $withFirstNode = false])
  • 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()

Documentation generated on Sun, 03 Jul 2005 12:46:10 +0200 by phpDocumentor 1.3.0RC3