cvs: php-src(PHP_5_1) /ext/spl/examples recursivefilteriterator.inc

From: Date: Sun, 04 Sep 2005 18:55:04 +0000
Subject: cvs: php-src(PHP_5_1) /ext/spl/examples recursivefilteriterator.inc
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-33799@lists.php.net to get a copy of this message
helly Sun Sep 4 14:55:04 2005 EDT Modified files: (Branch: PHP_5_1) /php-src/ext/spl/examples recursivefilteriterator.inc Log: - MFH http://cvs.php.net/diff.php/php-src/ext/spl/examples/recursivefilteriterator.inc?r1=1.3&r2=1.3.2.1&ty=u Index: php-src/ext/spl/examples/recursivefilteriterator.inc diff -u php-src/ext/spl/examples/recursivefilteriterator.inc:1.3 php-src/ext/spl/examples/recursivefilteriterator.inc:1.3.2.1 --- php-src/ext/spl/examples/recursivefilteriterator.inc:1.3 Tue Feb 8 14:10:05 2005 +++ php-src/ext/spl/examples/recursivefilteriterator.inc Sun Sep 4 14:55:03 2005 @@ -13,6 +13,7 @@ * @brief A recursive Filter * @author Marcus Boerger * @version 1.0 + * @since PHP 6.0 * * Passes the RecursiveIterator interface to the inner Iterator and provides * the same functionality as FilterIterator. This allows you to skip parents @@ -28,27 +29,30 @@ */ abstract class RecursiveFilterIterator extends FilterIterator implements RecursiveIterator { - /*! The constructor takes a RecursiveIterator + /** @param $it the RecursiveIterator to filter */ function __construct(RecursiveIterator $it) { - $this->ref = new ReflectionClass($this); parent::__construct($it); } - /*! return whether the inner iterator has children + /** @return whether the current element has children */ function hasChildren() { return $this->getInnerIterator()->hasChildren(); } - /*! \return children as instance of derived RecursiveFilterIterator class + /** @return an iterator for the current elements children * - * \see RecursiveFilterIterator + * @note the returned iterator will be of the same class as $this */ function getChildren() { + if (empty($this->ref)) + { + $this->ref = new ReflectionClass($this); + } return $this->ref->newInstance($this->getInnerIterator()->getChildren()); }

« previous php.cvs (#33799) next »