< RecursiveFilterIterator > Protocol Reference
[Internal classes]

Iterator to filter recursive iterators. More...

Inheritance diagram for < RecursiveFilterIterator >:

Inheritance graph
{RecursiveIterator\n||+ getChildren()\l+ hasChildren()\l}{Iterator\n||+ current()\l+ key()\l+ next()\l+ rewind()\l+ valid()\l}{Traversable\n||}
[legend]
Collaboration diagram for < RecursiveFilterIterator >:

Collaboration graph
{RecursiveIterator\n||+ getChildren()\l+ hasChildren()\l}{Iterator\n||+ current()\l+ key()\l+ next()\l+ rewind()\l+ valid()\l}{Traversable\n||}
[legend]
List of all members.

Public Member Functions

 __construct (RecursiveIterator $it)
 current ()
 getChildren ()
 hasChildren ()
 key ()
 next ()
 rewind ()
 valid ()

Private Attributes

 $ref

Detailed Description

Iterator to filter recursive iterators.

Author:
Marcus Boerger
Version:
1.0
Since:
PHP 5.1
Passes the RecursiveIterator interface to the inner Iterator and provides the same functionality as FilterIterator. This allows you to skip parents and all their childs before loading them all. You need to care about function getChildren() because it may not always suit your needs. The builtin behavior uses reflection to return a new instance of the exact same class it is called from. That is you extend RecursiveFilterIterator and getChildren() will create instance of that class. The problem is that doing this does not transport any state or control information of your accept() implementation to the new instance. To overcome this problem you might need to overwrite getChildren(), call this implementation and pass the control vaules manually.

Definition at line 30 of file recursivefilteriterator.inc.


Constructor & Destructor Documentation

RecursiveFilterIterator-p::__construct ( RecursiveIterator it  ) 

Parameters:
$it the RecursiveIterator to filter

Definition at line 34 of file recursivefilteriterator.inc.

References $it.

00035     {
00036         parent::__construct($it);
00037     }


Member Function Documentation

Iterator::current (  )  [inherited]

Return the current element.

Implemented in ArrayIterator, DirectoryIterator, RecursiveDirectoryIterator, SimpleXMLIterator, SubClasses, DbaReader, DirectoryTreeIterator, DualIterator, RecursiveTreeIterator, AppendIterator, CachingIterator, EmptyIterator, < FilterIterator >, IteratorIterator, LimitIterator, RecursiveIteratorIterator, SplFileObject, and SplObjectStorage.

RecursiveFilterIterator-p::getChildren (  ) 

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 50 of file recursivefilteriterator.inc.

References RecursiveIterator::getChildren().

00051     {
00052         if (empty($this->ref))
00053         {
00054             $this->ref = new ReflectionClass($this);
00055         }
00056         return $this->ref->newInstance($this->getInnerIterator()->getChildren());
00057     }

Here is the call graph for this function:

RecursiveIterator::getChildren

RecursiveFilterIterator-p::hasChildren (  ) 

Returns:
whether the current element has children

Implements RecursiveIterator.

Definition at line 41 of file recursivefilteriterator.inc.

00042     {
00043         return $this->getInnerIterator()->hasChildren();
00044     }

Iterator::key (  )  [inherited]

Return the key of the current element.

Implemented in ArrayIterator, DirectoryIterator, RecursiveDirectoryIterator, SimpleXMLIterator, DbaReader, DualIterator, RecursiveTreeIterator, AppendIterator, CachingIterator, EmptyIterator, < FilterIterator >, IteratorIterator, LimitIterator, RecursiveIteratorIterator, SplFileObject, and SplObjectStorage.

Iterator::next (  )  [inherited]

Move forward to next element.

Implemented in ArrayIterator, DirectoryIterator, SimpleXMLIterator, DbaReader, DualIterator, AppendIterator, CachingIterator, EmptyIterator, < FilterIterator >, InfiniteIterator, IteratorIterator, LimitIterator, RecursiveIteratorIterator, SplFileObject, and SplObjectStorage.

Iterator::rewind (  )  [inherited]

Rewind the Iterator to the first element.

Implemented in ArrayIterator, DirectoryIterator, SimpleXMLIterator, DbaReader, DualIterator, RecursiveCompareDualIterator, AppendIterator, CachingIterator, EmptyIterator, < FilterIterator >, IteratorIterator, LimitIterator, NoRewindIterator, RecursiveCachingIterator, RecursiveIteratorIterator, SplFileObject, and SplObjectStorage.

Iterator::valid (  )  [inherited]

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

Implemented in ArrayIterator, DirectoryIterator, SimpleXMLIterator, DbaReader, DualIterator, AppendIterator, CachingIterator, EmptyIterator, < FilterIterator >, IteratorIterator, LimitIterator, RecursiveIteratorIterator, SplFileObject, and SplObjectStorage.


Member Data Documentation

RecursiveFilterIterator-p::$ref [private]

Definition at line 59 of file recursivefilteriterator.inc.


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