]> granicus.if.org Git - php/commitdiff
- MFH
authorMarcus Boerger <helly@php.net>
Sun, 4 Sep 2005 18:55:03 +0000 (18:55 +0000)
committerMarcus Boerger <helly@php.net>
Sun, 4 Sep 2005 18:55:03 +0000 (18:55 +0000)
ext/spl/examples/recursivefilteriterator.inc

index 44e1bbcb99fb0fffe1a53eb87c7c8399e7c565ae..f78abe8a52cb100a1cb8f436834c325e26b369dc 100755 (executable)
@@ -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
  */
 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());
        }