SubClasses Class Reference

Collects sub classes for given class or interface. More...

Inheritance diagram for SubClasses:

Inheritance graph
{RecursiveArrayIterator\n|- $ref\l|+ getChildren()\l+ hasChildren()\l}{ArrayIterator\n|+ ARRAY_AS_PROPS\l+ STD_PROP_LIST\l|+ __construct()\l+ append()\l+ asort()\l+ count()\l+ current()\l+ getArrayCopy()\l+ getFlags()\l+ key()\l+ ksort()\l+ natcasesort()\l+ natsort()\l+ next()\l+ offsetExists()\l+ offsetGet()\l+ offsetSet()\l+ offsetUnset()\l+ rewind()\l+ seek()\l+ setFlags()\l+ uasort()\l+ uksort()\l+ valid()\l}{SeekableIterator\n||+ seek()\l}{Iterator\n||+ current()\l+ key()\l+ next()\l+ rewind()\l+ valid()\l}{RecursiveIterator\n||+ getChildren()\l+ hasChildren()\l}{Traversable\n||}{ArrayAccess\n||+ offsetExists()\l+ offsetGet()\l+ offsetSet()\l+ offsetUnset()\l}{Countable\n||+ count()\l}
[legend]
Collaboration diagram for SubClasses:

Collaboration graph
{RecursiveArrayIterator\n|- $ref\l|+ getChildren()\l+ hasChildren()\l}{ArrayIterator\n|+ ARRAY_AS_PROPS\l+ STD_PROP_LIST\l|+ __construct()\l+ append()\l+ asort()\l+ count()\l+ current()\l+ getArrayCopy()\l+ getFlags()\l+ key()\l+ ksort()\l+ natcasesort()\l+ natsort()\l+ next()\l+ offsetExists()\l+ offsetGet()\l+ offsetSet()\l+ offsetUnset()\l+ rewind()\l+ seek()\l+ setFlags()\l+ uasort()\l+ uksort()\l+ valid()\l}{SeekableIterator\n||+ seek()\l}{Iterator\n||+ current()\l+ key()\l+ next()\l+ rewind()\l+ valid()\l}{RecursiveIterator\n||+ getChildren()\l+ hasChildren()\l}{Traversable\n||}{ArrayAccess\n||+ offsetExists()\l+ offsetGet()\l+ offsetSet()\l+ offsetUnset()\l}{Countable\n||+ count()\l}
[legend]
List of all members.

Public Member Functions

 __construct ($base, $check_interfaces=false)
 append ($value)
 asort ()
 count ()
 current ()
 getArrayCopy ()
 getChildren ()
 getFlags ()
 hasChildren ()
 key ()
 ksort ()
 natcasesort ()
 natsort ()
 next ()
 offsetExists ($index)
 offsetGet ($index)
 offsetSet ($index, $newval)
 offsetUnset ($index)
 rewind ()
 seek ($position)
 setFlags ($flags)
 uasort (mixed cmp_function)
 uksort (mixed cmp_function)
 valid ()

Public Attributes

const ARRAY_AS_PROPS = 0x00000002
const STD_PROP_LIST = 0x00000001

Detailed Description

Collects sub classes for given class or interface.

Definition at line 32 of file class_tree.php.


Constructor & Destructor Documentation

SubClasses::__construct ( base,
check_interfaces = false 
)

Parameters:
base base class to collect sub classes for

Parameters:
check_interfaces whether we deal with interfaces

Reimplemented from ArrayIterator.

Definition at line 37 of file class_tree.php.

References ArrayIterator::offsetSet().

00038     {
00039         foreach(get_declared_classes() as $cname)
00040         {
00041             if (strcasecmp(get_parent_class($cname), $base) == 0)
00042             {
00043                 $this->offsetSet($cname, new SubClasses($cname));
00044             }
00045             if ($check_interfaces)
00046             {
00047                 foreach(class_implements($cname) as $iname)
00048                 {
00049                     if (strcasecmp($iname, $base) == 0)
00050                     {
00051                         $this->offsetSet($cname, new SubClasses($cname));
00052                     }
00053                 }
00054             }
00055         }
00056         if ($check_interfaces)
00057         {
00058             foreach(get_declared_interfaces() as $cname)
00059             {
00060                 foreach(class_implements($cname) as $iname)
00061                 {
00062                     if (strcasecmp($iname, $base) == 0)
00063                     {
00064                         $this->offsetSet($cname, new SubClasses($cname, true));
00065                     }
00066                 }
00067             }
00068         }
00069     }

Here is the call graph for this function:

ArrayIterator::offsetSet


Member Function Documentation

ArrayIterator::append ( value  )  [inherited]

Parameters:
$value is appended as last element

Warning:
this method cannot be called when the ArrayIterator refers to an object.

Definition at line 804 of file spl.php.

00804 {}

ArrayIterator::asort (  )  [inherited]

Sort the entries by values.

Definition at line 759 of file spl.php.

00759 {}

ArrayIterator::count (  )  [inherited]

Returns:
the number of elements in the array or the number of public properties in the object.

Implements Countable.

Definition at line 820 of file spl.php.

00820 {}

SubClasses::current (  ) 

Returns:
key() since that is the name we need

Reimplemented from ArrayIterator.

Definition at line 73 of file class_tree.php.

00074     {
00075         return parent::key();
00076     }

ArrayIterator::getArrayCopy (  )  [inherited]

Returns:
a copy of the array

Note:
when the ArrayIterator refers to an object then this method returns an array of the public properties.

Definition at line 810 of file spl.php.

00810 {}

RecursiveArrayIterator::getChildren (  )  [inherited]

Returns:
an iterator for the current elements children

Note:
the returned iterator will be of the same class as $this

Implements RecursiveIterator.

Definition at line 43 of file recursivearrayiterator.inc.

References ArrayIterator::current().

00044     {
00045         if ($this->current() instanceof self)
00046         {
00047             return $this->current();
00048         }
00049         if (empty($this->ref))
00050         {
00051             $this->ref = new ReflectionClass($this);
00052         }
00053         return $this->ref->newInstance($this->current());
00054     }

Here is the call graph for this function:

ArrayIterator::current

ArrayIterator::getFlags (  )  [inherited]

Returns:
current flags

Definition at line 755 of file spl.php.

00755 {}

RecursiveArrayIterator::hasChildren (  )  [inherited]

Returns:
whether the current element has children

Implements RecursiveIterator.

Definition at line 34 of file recursivearrayiterator.inc.

References ArrayIterator::current().

00035     {
00036         return is_array($this->current());
00037     }

Here is the call graph for this function:

ArrayIterator::current

ArrayIterator::key (  )  [inherited]

Return the key of the current element.

Implements Iterator.

Definition at line 832 of file spl.php.

00832 {}

ArrayIterator::ksort (  )  [inherited]

Sort the entries by key.

Definition at line 763 of file spl.php.

00763 {}

ArrayIterator::natcasesort (  )  [inherited]

Sort the entries by values using case insensitive "natural order" algorithm.

Definition at line 779 of file spl.php.

00779 {}

ArrayIterator::natsort (  )  [inherited]

Sort the entries by values using "natural order" algorithm.

Definition at line 775 of file spl.php.

00775 {}

ArrayIterator::next (  )  [inherited]

Move forward to next element.

Implements Iterator.

Definition at line 835 of file spl.php.

00835 {}

ArrayIterator::offsetExists ( index  )  [inherited]

Parameters:
$index offset to inspect

Returns:
whetehr offset $index esists

Implements ArrayAccess.

Definition at line 784 of file spl.php.

00784 {}

ArrayIterator::offsetGet ( index  )  [inherited]

Parameters:
$index offset to return value for

Returns:
value at offset $index

Implements ArrayAccess.

Definition at line 789 of file spl.php.

00789 {}

ArrayIterator::offsetSet ( index,
newval 
) [inherited]

Parameters:
$index index to set

Parameters:
$newval new value to store at offset $index

Implements ArrayAccess.

Definition at line 794 of file spl.php.

Referenced by __construct().

00794 {}

ArrayIterator::offsetUnset ( index  )  [inherited]

Parameters:
$index offset to unset

Implements ArrayAccess.

Definition at line 798 of file spl.php.

00798 {}

ArrayIterator::rewind (  )  [inherited]

Rewind the Iterator to the first element.

Implements Iterator.

Definition at line 823 of file spl.php.

00823 {}

ArrayIterator::seek ( position  )  [inherited]

Parameters:
$position offset to seek to

Exceptions:
OutOfBoundsException if $position is invalid

Implements SeekableIterator.

Definition at line 815 of file spl.php.

00815 {}

ArrayIterator::setFlags ( flags  )  [inherited]

Set behavior flags.

Parameters:
$flags bitmask as follows: 0 set: properties of the object have their normal functionality when accessed as list (var_dump, foreach, etc.) 1 set: array indices can be accessed as properties in read/write

Definition at line 750 of file spl.php.

00750 {}

ArrayIterator::uasort ( mixed  cmp_function  )  [inherited]

Sort the entries by values using user defined function.

Definition at line 767 of file spl.php.

00767 {}

ArrayIterator::uksort ( mixed  cmp_function  )  [inherited]

Sort the entries by key using user defined function.

Definition at line 771 of file spl.php.

00771 {}

ArrayIterator::valid (  )  [inherited]

Check if there is a current element after calls to rewind() or next().

Implements Iterator.

Definition at line 826 of file spl.php.

00826 {}


Member Data Documentation

const ArrayIterator::ARRAY_AS_PROPS = 0x00000002 [inherited]

Array indices can be accessed as properties in read/write.

Definition at line 733 of file spl.php.

const ArrayIterator::STD_PROP_LIST = 0x00000001 [inherited]

Properties of the object have their normal functionality when accessed as list (var_dump, foreach, etc.

)

Definition at line 731 of file spl.php.


The documentation for this class was generated from the following file:
Generated on Thu Apr 26 01:07:57 2007 for SPL-StandardPHPLibrary by  doxygen 1.5.2