SPL-StandardPHPLibrary
Public Member Functions | Protected Member Functions
ParentIterator Class Reference
Inheritance diagram for ParentIterator:
Inheritance graph
[legend]
Collaboration diagram for ParentIterator:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 __call ($func, $params)
 accept ()
 current ()
 getChildren ()
 getInnerIterator ()
 hasChildren ()
 key ()
 next ()
 rewind ()
 valid ()

Protected Member Functions

 __clone ()
 fetch ()

Detailed Description

Iterator to filter parents.

Author:
Marcus Boerger
Version:
1.2
Since:
PHP 5.1

This extended FilterIterator allows a recursive iteration using RecursiveIteratorIterator that only shows those elements which have children.

Definition at line 22 of file parentiterator.inc.


Member Function Documentation

FilterIterator::__call ( func,
params 
) [inherited]

Aggregate the inner iterator.

Parameters:
funcName of method to invoke
paramsArray of parameters to pass to method

Reimplemented in SearchIterator.

Definition at line 121 of file filteriterator.inc.

    {
        return call_user_func_array(array($this->it, $func), $params);
    }
FilterIterator::__clone ( ) [protected, inherited]

hidden __clone

Reimplemented in KeyFilter.

Definition at line 104 of file filteriterator.inc.

                                 {
        // disallow clone 
    }
ParentIterator::accept ( )
Returns:
whetehr the current element has children

Reimplemented from FilterIterator.

Definition at line 26 of file parentiterator.inc.

    {
        return $this->it->hasChildren();
    }
FilterIterator::current ( ) [inherited]
Returns:
The current value

Implements Iterator.

Reimplemented in RegexIterator, CallbackFilterIterator, and IniGroups.

Definition at line 97 of file filteriterator.inc.

Referenced by RegexFindFile\accept(), and FindFile\accept().

                       {
        return $this->it->current();
    }
FilterIterator::fetch ( ) [protected, inherited]

Fetch next element and store it.

Returns:
void

Definition at line 61 of file filteriterator.inc.

References FilterIterator\accept().

Referenced by FilterIterator\next(), and FilterIterator\rewind().

                               {
        while ($this->it->valid()) {
            if ($this->accept()) {
                return;
            }
            $this->it->next();
        };
    }

Here is the call graph for this function:

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

References FilterIterator\getInnerIterator().

    {
        if (empty($this->ref))
        {
            $this->ref = new ReflectionClass($this);
        }
        return $this->ref->newInstance($this->getInnerIterator()->getChildren());
    }

Here is the call graph for this function:

FilterIterator::getInnerIterator ( ) [inherited]
RecursiveFilterIterator::hasChildren ( ) [inherited]
Returns:
whether the current element has children

Implements RecursiveIterator.

Definition at line 41 of file recursivefilteriterator.inc.

References FilterIterator\getInnerIterator().

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

Here is the call graph for this function:

FilterIterator::key ( ) [inherited]
Returns:
The current key

Implements Iterator.

Reimplemented in RegexIterator, CallbackFilterIterator, IniGroups, and DirectoryFilterDots.

Definition at line 90 of file filteriterator.inc.

Referenced by KeyFilter\accept().

                   {
        return $this->it->key();
    }
FilterIterator::next ( ) [inherited]

Move to next element.

Returns:
void

Implements Iterator.

Reimplemented in SearchIterator.

Definition at line 75 of file filteriterator.inc.

References FilterIterator\fetch().

                    {
        $this->it->next();
        $this->fetch();
    }

Here is the call graph for this function:

FilterIterator::rewind ( ) [inherited]

Rewind the inner iterator.

Implements Iterator.

Reimplemented in SearchIterator.

Definition at line 42 of file filteriterator.inc.

References FilterIterator\fetch().

                      { 
        $this->it->rewind();
        $this->fetch();
    }

Here is the call graph for this function:

FilterIterator::valid ( ) [inherited]
Returns:
Whether more elements are available

Implements Iterator.

Reimplemented in SearchIterator.

Definition at line 83 of file filteriterator.inc.

                     {
        return $this->it->valid();
    }

The documentation for this class was generated from the following file: