|
SPL-StandardPHPLibrary
|


Public Member Functions | |
| __call ($func, $params) | |
| __construct (Iterator $it, $regex) | |
| accept () | |
| current () | |
| getInnerIterator () | |
| getRegex () | |
| key () | |
| next () | |
| rewind () | |
| valid () | |
Protected Member Functions | |
| __clone () | |
| fetch () | |
Private Attributes | |
| $regex | |
Regular expression filter for string iterators.
Instances of this class act as a filter around iterators whose elements are strings. In other words you can put an iterator into the constructor and the instance will only return elements which match the given regular expression.
Definition at line 22 of file keyfilter.inc.
| KeyFilter::__construct | ( | Iterator $ | it, |
| $ | regex | ||
| ) |
Constructs a filter around an iterator whose elemnts are strings.
If the given iterator is of type spl_sequence then its rewind() method is called.
| it | Object that implements at least spl_forward |
| regex | Regular expression used as a filter. |
Definition at line 35 of file keyfilter.inc.
References $regex.
{
parent::__construct($it);
$this->regex = $regex;
}
| FilterIterator::__call | ( | $ | func, |
| $ | params | ||
| ) | [inherited] |
Aggregate the inner iterator.
| func | Name of method to invoke |
| params | Array 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);
}
| KeyFilter::__clone | ( | ) | [protected] |
hidden __clone
Reimplemented from FilterIterator.
Definition at line 58 of file keyfilter.inc.
{
// disallow clone
}
| KeyFilter::accept | ( | ) |
Reimplemented from FilterIterator.
Definition at line 43 of file keyfilter.inc.
References FilterIterator\getInnerIterator(), and FilterIterator\key().
{
return ereg($this->regex, $this->getInnerIterator()->key());
}

| FilterIterator::current | ( | ) | [inherited] |
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.
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();
};
}

| FilterIterator::getInnerIterator | ( | ) | [inherited] |
Implements OuterIterator.
Definition at line 111 of file filteriterator.inc.
Referenced by SearchIterator\__call(), DirectoryFilterDots\accept(), accept(), RecursiveRegexIterator\getChildren(), RecursiveFilterIterator\getChildren(), RecursiveRegexIterator\hasChildren(), RecursiveFilterIterator\hasChildren(), and DirectoryFilterDots\key().
{
return $this->it;
}
| KeyFilter::getRegex | ( | ) |
Definition at line 50 of file keyfilter.inc.
{
return $this->regex;
}
| FilterIterator::key | ( | ) | [inherited] |
Implements Iterator.
Reimplemented in RegexIterator, CallbackFilterIterator, IniGroups, and DirectoryFilterDots.
Definition at line 90 of file filteriterator.inc.
Referenced by accept().
{
return $this->it->key();
}
| FilterIterator::next | ( | ) | [inherited] |
Move to next element.
Implements Iterator.
Reimplemented in SearchIterator.
Definition at line 75 of file filteriterator.inc.
References FilterIterator\fetch().
{
$this->it->next();
$this->fetch();
}

| 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();
}

| FilterIterator::valid | ( | ) | [inherited] |
Implements Iterator.
Reimplemented in SearchIterator.
Definition at line 83 of file filteriterator.inc.
{
return $this->it->valid();
}
KeyFilter::$regex [private] |
regular exoression used as filter
Definition at line 25 of file keyfilter.inc.
Referenced by __construct().
1.7.5.1