Arquivos
hhvm/hphp/system/php/spl/iterators/AppendIterator.php
T
Drew Paroski e6b6aa0b09 Clean up the hphp/system folder
I noticed that directorty structure of hphp/system was a bit scattered, so
I consolidated things to reduce the total number of folders and to put
related things together with each other.

This diff moves the contents of "hphp/system/classes_hhvm" into
"hphp/system", it moves the contents of "hphp/system/lib" into
"hphp/system", moves "hphp/idl" to "hphp/system/idl", and moves the
contents of "hphp/system/globals" into "hphp/system/idl".
2013-06-15 23:29:49 -07:00

142 linhas
4.0 KiB
PHP

<?php
// This doc comment block generated by idl/sysdoc.php
/**
* ( excerpt from http://php.net/manual/en/class.appenditerator.php )
*
* An Iterator that iterates over several iterators one after the other.
*
*/
class AppendIterator implements OuterIterator {
private $iterators;
// This doc comment block generated by idl/sysdoc.php
/**
* ( excerpt from http://php.net/manual/en/appenditerator.construct.php )
*
* Constructs an AppendIterator.
*
* @return mixed No value is returned.
*/
function __construct() {
$this->iterators = new ArrayIterator(array());
}
// This doc comment block generated by idl/sysdoc.php
/**
* ( excerpt from http://php.net/manual/en/appenditerator.append.php )
*
* Appends an iterator.
*
* @it mixed The iterator to append.
*
* @return mixed No value is returned.
*/
function append(Iterator $it) {
$this->iterators->append($it);
}
// This doc comment block generated by idl/sysdoc.php
/**
* ( excerpt from
* http://php.net/manual/en/appenditerator.getinneriterator.php )
*
* This method returns the current inner iterator.
*
* @return mixed The current inner iterator, or NULL if there is not
* one.
*/
function getInnerIterator() {
return $this->iterators->current();
}
// This doc comment block generated by idl/sysdoc.php
/**
* ( excerpt from http://php.net/manual/en/appenditerator.rewind.php )
*
* Rewind to the first element of the first inner Iterator.
*
* @return mixed No value is returned.
*/
function rewind() {
$this->iterators->rewind();
if ($this->iterators->valid()) {
$this->getInnerIterator()->rewind();
}
}
// This doc comment block generated by idl/sysdoc.php
/**
* ( excerpt from http://php.net/manual/en/appenditerator.valid.php )
*
* Checks validity of the current element.
*
* @return mixed Returns TRUE if the current iteration is valid,
* FALSE otherwise.
*/
function valid() {
return $this->iterators->valid() && $this->getInnerIterator()->valid();
}
// This doc comment block generated by idl/sysdoc.php
/**
* ( excerpt from http://php.net/manual/en/appenditerator.current.php )
*
* Gets the current value.
*
* @return mixed The current value if it is valid or NULL otherwise.
*/
function current() {
/* 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;
}
// This doc comment block generated by idl/sysdoc.php
/**
* ( excerpt from http://php.net/manual/en/appenditerator.key.php )
*
* Get the current key.
*
* @return mixed The current key if it is valid or NULL otherwise.
*/
function key() {
return $this->iterators->valid() ? $this->getInnerIterator()->key() : NULL;
}
// This doc comment block generated by idl/sysdoc.php
/**
* ( excerpt from http://php.net/manual/en/appenditerator.next.php )
*
* Moves to the next element. If this means to another Iterator then it
* rewinds that Iterator.
*
* @return mixed No value is returned.
*/
function next() {
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();
}
}
function __call($func, $params) {
return call_user_func_array(array($this->getInnerIterator(), $func),
$params);
}
}