Arquivos
hhvm/hphp/system/php/spl/iterators/RecursiveArrayIterator.php
T
Paul Tarjan 9ce7792d8d implement RecursiveArrayIterator
I went through all the tests that mentioned this and looked at them. All of them don't pass because of other missing SPL problems not related to this class (and this class is simple so I wouldn't assume them to blame to it).

Closes #766
2013-07-23 11:44:30 -07:00

55 linhas
1.6 KiB
PHP

<?php
// This doc comment block generated by idl/sysdoc.php
/**
* ( excerpt from http://php.net/manual/en/class.recursivearrayiterator.php
* )
*
* This iterator allows to unset and modify values and keys while
* iterating over Arrays and Objects in the same way as the ArrayIterator.
* Additionally it is possible to iterate over the current iterator entry.
*
*/
class RecursiveArrayIterator
extends ArrayIterator
implements RecursiveIterator {
const CHILD_ARRAYS_ONLY = 4;
// This doc comment block generated by idl/sysdoc.php
/**
* ( excerpt from
* http://php.net/manual/en/recursivearrayiterator.getchildren.php )
*
* Returns an iterator for the current iterator entry.
*
* @return mixed An iterator for the current entry, if it is an array
* or object.
*/
public function getChildren() {
return new RecursiveArrayIterator(
$this->hasChildren() ? $this->current() : null,
$this->getFlags()
);
}
// This doc comment block generated by idl/sysdoc.php
/**
* ( excerpt from
* http://php.net/manual/en/recursivearrayiterator.haschildren.php )
*
* Returns whether current entry is an array or an object for which an
* iterator can be obtained via RecursiveArrayIterator::getChildren().
*
* @return mixed Returns TRUE if the current entry is an array or an
* object, otherwise FALSE is returned.
*/
public function hasChildren() {
return
is_array($this->current()) ||
(is_object($this->current()) &&
($this->getFlags() & self::CHILD_ARRAYS_ONLY) == 0);
}
}