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

List of all members.

Public Member Functions

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

Protected Member Functions

 __clone ()
 fetch ()

Private Attributes

 $done = false

Detailed Description

Iterator to search for a specific element.

Author:
Marcus Boerger
Version:
1.0

This extended FilterIterator stops after finding the first acceptable value.

Definition at line 20 of file searchiterator.inc.


Member Function Documentation

SearchIterator::__call ( func,
params 
)

Aggregates the inner iterator.

Reimplemented from FilterIterator.

Definition at line 52 of file searchiterator.inc.

References FilterIterator\getInnerIterator().

    {
        return call_user_func_array(array($this->getInnerIterator(), $func), $params);
    }

Here is the call graph for this function:

FilterIterator::__clone ( ) [protected, inherited]

hidden __clone

Reimplemented in KeyFilter.

Definition at line 104 of file filteriterator.inc.

                                 {
        // disallow clone 
    }
FilterIterator::accept ( ) [abstract, inherited]

Accept function to decide whether an element of the inner iterator should be accessible through the Filteriterator.

Returns:
whether or not to expose the current element of the inner iterator.

Reimplemented in RegexIterator, CallbackFilterIterator, FindFile, KeyFilter, RegexFindFile, DirectoryFilterDots, and ParentIterator.

Referenced by FilterIterator\fetch().

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:

FilterIterator::getInnerIterator ( ) [inherited]
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();
    }
SearchIterator::next ( )

Do not move forward but instead mark as finished.

Returns:
void

Reimplemented from FilterIterator.

Definition at line 45 of file searchiterator.inc.

    {
        $this->done = true;
    }
SearchIterator::rewind ( )

Rewind and reset so that it once again searches.

Returns:
void

Reimplemented from FilterIterator.

Definition at line 28 of file searchiterator.inc.

    {
        parent::rewind();
        $this->done = false;
    }
SearchIterator::valid ( )
Returns:
whether the current element is valid which can only happen once per iteration.

Reimplemented from FilterIterator.

Definition at line 37 of file searchiterator.inc.

    {
        return !$this->done && parent::valid();
    }

Member Data Documentation

SearchIterator::$done = false [private]

whether an entry was found already

Definition at line 23 of file searchiterator.inc.


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