helly           Sat May  8 08:35:22 2004 EDT

  Added files:                 
    /php-src/ext/spl/examples   regexfindfile.inc 

  Modified files:              
    /php-src/ext/spl/examples   appenditerator.inc infiniteiterator.inc 
                                searchiterator.inc 
  Log:
  - Docu updates
  - Add missing example file
  - Fix aggregation of inner iterators in examples
  
  
http://cvs.php.net/diff.php/php-src/ext/spl/examples/appenditerator.inc?r1=1.5&r2=1.6&ty=u
Index: php-src/ext/spl/examples/appenditerator.inc
diff -u php-src/ext/spl/examples/appenditerator.inc:1.5 
php-src/ext/spl/examples/appenditerator.inc:1.6
--- php-src/ext/spl/examples/appenditerator.inc:1.5     Thu Apr 29 18:25:44 2004
+++ php-src/ext/spl/examples/appenditerator.inc Sat May  8 08:35:21 2004
@@ -1,30 +1,40 @@
 <?php
 
-/**
+/** \ingroup Examples
  * @brief   Iterator that iterates over several iterators one after the other
  * @author  Marcus Boerger
  * @version 1.0
- *
  */
 class AppendIterator implements Iterator
 {
-       protected $iterators;
+       /** @internal array of inner iterators */
+       private $iterators;
 
+       /** Construct an empty AppendIterator
+        */
        function __construct()
        {
                $this->iterators = new ArrayIterator();
        }
-       
+
+       /** Append an Iterator
+        * @param $it Iterator to append
+        */     
        function append(Iterator $it)
        {
                $this->iterators->append($it);
        }
 
+       /** @return the current inner Iterator
+        */
        function getInnerIterator()
        {
                return $this->iterators->current();
        }
 
+       /** Rewind to the first element of the first inner Iterator.
+        * @return void
+        */
        function rewind()
        {
                $this->iterators->rewind();
@@ -34,11 +44,15 @@
                }
        }
 
+       /** @return whether the current element is valid
+         */
        function valid()
        {
                return $this->iterators->valid() && $this->getInnerIterator()->valid();
        }
 
+       /** @return the current value if it is valid or \c NULL
+        */
        function current()
        {
                /* Using $this->valid() would be exactly the same; it would omit
@@ -48,11 +62,17 @@
                return $this->iterators->valid() ? 
$this->getInnerIterator()->current() : NULL;
        }
 
+       /** @return the current key if it is valid or \c NULL
+        */
        function key()
        {
                return $this->iterators->valid() ? $this->getInnerIterator()->key() : 
NULL;
        }
-       
+
+       /** Move to the next element. If this means to another Iterator that 
+        * rewind that Iterator.
+        * @return void
+        */
        function next()
        {
                if (!$this->iterators->valid())
@@ -75,6 +95,13 @@
                        $this->iterators->next();
                }
        }
+
+       /** Aggregates the inner iterator
+        */     
+       function __call($func, $params)
+       {
+               return call_user_func_array(array($this->getInnerIterator(), $func), 
$params);
+       }
 }
 
 ?>
\ No newline at end of file
http://cvs.php.net/diff.php/php-src/ext/spl/examples/infiniteiterator.inc?r1=1.2&r2=1.3&ty=u
Index: php-src/ext/spl/examples/infiniteiterator.inc
diff -u php-src/ext/spl/examples/infiniteiterator.inc:1.2 
php-src/ext/spl/examples/infiniteiterator.inc:1.3
--- php-src/ext/spl/examples/infiniteiterator.inc:1.2   Sat May  8 08:24:15 2004
+++ php-src/ext/spl/examples/infiniteiterator.inc       Sat May  8 08:35:21 2004
@@ -86,7 +86,7 @@
         */     
        function __call($func, $params)
        {
-               return call_user_func_array(array($this->getSubIterator(), $func), 
$params);
+               return call_user_func_array(array($this->it, $func), $params);
        }
 }
 
http://cvs.php.net/diff.php/php-src/ext/spl/examples/searchiterator.inc?r1=1.4&r2=1.5&ty=u
Index: php-src/ext/spl/examples/searchiterator.inc
diff -u php-src/ext/spl/examples/searchiterator.inc:1.4 
php-src/ext/spl/examples/searchiterator.inc:1.5
--- php-src/ext/spl/examples/searchiterator.inc:1.4     Sat May  8 08:24:15 2004
+++ php-src/ext/spl/examples/searchiterator.inc Sat May  8 08:35:21 2004
@@ -42,7 +42,7 @@
         */     
        function __call($func, $params)
        {
-               return call_user_func_array(array($this->getSubIterator(), $func), 
$params);
+               return call_user_func_array(array($this->getInnerIterator(), $func), 
$params);
        }
 }
 

http://cvs.php.net/co.php/php-src/ext/spl/examples/regexfindfile.inc?r=1.1&p=1
Index: php-src/ext/spl/examples/regexfindfile.inc
+++ php-src/ext/spl/examples/regexfindfile.inc
<?php

/**
 * @brief   Find files by regular expression
 * @author  Marcus Boerger
 * @version 1.1
 *
 */
class RegexFindFile extends FindFile
{
        /** Construct from path and regular expression
         *
         * @param $path the directory to search in
         *              If path contains ';' then this parameter is split and every
         *              part of it is used as separate directory.
         * @param $regex perl style regular expression to find files with
         */
        function __construct($path, $regex)
        {
                parent::__construct($path, $regex);
        }

        /** @return whether the current filename matches the regular expression.
         */
        function accept()
        {
                return preg_match($this->getSearch(), $this->current());
        }
}

?>

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to