|
SPL-StandardPHPLibrary
|


Public Member Functions | |
| __call ($func, $params) | |
| __construct () | |
| append (Iterator $it) | |
| current () | |
| getInnerIterator () | |
| key () | |
| next () | |
| rewind () | |
| valid () | |
Private Attributes | |
| $iterators | |
Iterator that iterates over several iterators one after the other.
Definition at line 18 of file appenditerator.inc.
| AppendIterator::__construct | ( | ) |
Construct an empty AppendIterator.
Definition at line 25 of file appenditerator.inc.
{
$this->iterators = new ArrayIterator();
}
| AppendIterator::__call | ( | $ | func, |
| $ | params | ||
| ) |
Aggregates the inner iterator.
Definition at line 116 of file appenditerator.inc.
References getInnerIterator().
{
return call_user_func_array(array($this->getInnerIterator(), $func), $params);
}

| AppendIterator::append | ( | Iterator $ | it | ) |
Append an Iterator.
| $it | Iterator to append |
If the current state is invalid but the appended iterator is valid the AppendIterator itself becomes valid. However there will be no call to $it->rewind(). Also if the current state is invalid the inner ArrayIterator will be rewound und forwarded to the appended element.
Definition at line 38 of file appenditerator.inc.
{
$this->iterators->append($it);
}
| AppendIterator::current | ( | ) |
NULL Implements Iterator.
Definition at line 71 of file appenditerator.inc.
References getInnerIterator().
{
/* Using $this->valid() would be exactly the same; it would omit
* the access to a non valid element in the inner iterator. Since
* the user didn't respect the valid() return value false this
* must be intended hence we go on. */
return $this->iterators->valid() ? $this->getInnerIterator()->current() : NULL;
}

| AppendIterator::getInnerIterator | ( | ) |
Implements OuterIterator.
Definition at line 45 of file appenditerator.inc.
Referenced by __call(), current(), key(), next(), rewind(), and valid().
{
return $this->iterators->current();
}
| AppendIterator::key | ( | ) |
NULL Implements Iterator.
Definition at line 82 of file appenditerator.inc.
References getInnerIterator().
{
return $this->iterators->valid() ? $this->getInnerIterator()->key() : NULL;
}

| AppendIterator::next | ( | ) |
Move to the next element.
If this means to another Iterator that rewind that Iterator.
Implements Iterator.
Definition at line 91 of file appenditerator.inc.
References getInnerIterator(), and valid().
{
if (!$this->iterators->valid())
{
return; /* done all */
}
$this->getInnerIterator()->next();
if ($this->getInnerIterator()->valid())
{
return; /* found valid element in current inner iterator */
}
$this->iterators->next();
while ($this->iterators->valid())
{
$this->getInnerIterator()->rewind();
if ($this->getInnerIterator()->valid())
{
return; /* found element as first elemet in another iterator */
}
$this->iterators->next();
}
}

| AppendIterator::rewind | ( | ) |
Rewind to the first element of the first inner Iterator.
Implements Iterator.
Definition at line 53 of file appenditerator.inc.
References getInnerIterator().
{
$this->iterators->rewind();
if ($this->iterators->valid())
{
$this->getInnerIterator()->rewind();
}
}

| AppendIterator::valid | ( | ) |
Implements Iterator.
Definition at line 64 of file appenditerator.inc.
References getInnerIterator().
Referenced by next().
{
return $this->iterators->valid() && $this->getInnerIterator()->valid();
}

AppendIterator::$iterators [private] |
array of inner iterators
Definition at line 21 of file appenditerator.inc.
1.7.5.1