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

Class Methods

public Gumbo_Leaf __construct ( mix $val, [int|string $name] ) [line 61]

Constructor, Creates new Leaf

Parameter(s):

  • (mix) $val :: value of Leaf
  • (int|string) $name :: name of Leaf

[ Top ]
public void add ( Gumbo_Interface_Composite $tree, [bool $replace] ) [line 113]

Adds a Composite object to the Composite (for Branch use only) (method does nothing)

Parameter(s):


[ Top ]
public mix get ( [int|string $name] ) [line 98]

Returns the corresponding Composite object or value (use 'name' for the Composite Name)

Parameter(s):

  • (int|string) $name

[ Top ]
public void remove ( int|string $name ) [line 121]

Removes a Composite object based on the Composite name (for Branch use only) (method does nothing)

Parameter(s):

  • (int|string) $name

[ Top ]
public mixed __get ( int|string $name ) [line 86]

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 ]
public void __set ( string $name, mixed $val ) [line 71]

Sets the value (use any key string)

Parameter(s):

  • (string) $name
  • (mixed) $val

[ Top ]