php-src/ext/spl/internal/parentiterator.inc

46 lines
906 B
PHP
Raw Normal View History

2003-11-22 20:52:06 +00:00
<?php
2004-10-29 20:58:58 +00:00
/** @file parentiterator.inc
2004-10-31 19:05:37 +00:00
* @ingroup SPL
2004-10-29 20:58:58 +00:00
* @brief class FilterIterator
* @author Marcus Boerger
2005-02-08 19:10:06 +00:00
* @date 2003 - 2005
2004-10-29 20:58:58 +00:00
*
* SPL - Standard PHP Library
*/
/**
* @brief Iterator to filter parents
* @author Marcus Boerger
2005-09-15 03:54:42 +00:00
* @version 1.2
* @since PHP 5.1
2004-10-29 20:58:58 +00:00
*
* This extended FilterIterator allows a recursive iteration using
* RecursiveIteratorIterator that only shows those elements which have
* children.
*/
2005-09-15 03:54:42 +00:00
class ParentIterator extends RecursiveFilterIterator
2003-11-22 20:52:06 +00:00
{
2004-10-29 20:58:58 +00:00
/** @param $it the RecursiveIterator to filter
*/
function __construct(RecursiveIterator $it)
{
parent::__construct($it);
}
2004-10-29 20:58:58 +00:00
/** @return whetehr the current element has children
*/
2003-11-22 20:52:06 +00:00
function accept()
{
return $this->it->hasChildren();
}
2004-10-29 20:58:58 +00:00
/** @return the ParentIterator for the current elements children
*/
2003-11-22 20:52:06 +00:00
function getChildren()
{
return new ParentIterator($this->it->getChildren());
}
}
?>