]> granicus.if.org Git - php/commitdiff
Update examples
authorMarcus Boerger <helly@php.net>
Sun, 7 Dec 2003 13:21:47 +0000 (13:21 +0000)
committerMarcus Boerger <helly@php.net>
Sun, 7 Dec 2003 13:21:47 +0000 (13:21 +0000)
ext/spl/examples/cachingrecursiveiterator.inc
ext/spl/examples/directorygraphiterator.inc
ext/spl/examples/directorytreeiterator.inc

index 59709a75222297201f840740a9c06cf3b4417d23..898d40b0bcdabe6db020ad97ae68d1b02b17970d 100644 (file)
@@ -6,20 +6,20 @@ class CachingRecursiveIterator extends CachingIterator implements RecursiveItera
        protected $getChildren;
        protected $catch_get_child;
 
-       function __construct(RecursiveIterator $it, $catch_get_child = false)
+       function __construct(RecursiveIterator $it, $getStrVal = true, $catch_get_child = false)
        {
                $this->catch_get_child = $catch_get_child;
-               parent::__construct($it);
+               parent::__construct($it, $getStrVal);
        }
        
        function next()
        {
                if ($this->hasChildren = $this->it->hasChildren()) {
                        try {
-                               //$this->getChildren = new CachingRecursiveIterator($this->it->getChildren(), $this->catch_get_child);
+                               //$this->getChildren = new CachingRecursiveIterator($this->it->getChildren(), $this->getStrVal, $this->catch_get_child);
                                // workaround memleaks...
                                $child = $this->it->getChildren();
-                               $this->getChildren = new CachingRecursiveIterator($child, $this->catch_get_child);
+                               $this->getChildren = new CachingRecursiveIterator($child, $this->getStrVal, $this->catch_get_child);
                        }
                        catch(Exception $e) {
                                if (!$this->catch_get_child) {
index 190aba92eebc1cf3e8ef96025190e0cbd4f7b1c5..b1b8743b4cf92691bdc8298733e9a2e356dee621 100644 (file)
@@ -4,7 +4,7 @@ class DirectoryGraphIterator extends DirectoryTreeIterator
 {
        function __construct($path)
        {
-               RecursiveIteratorIterator::__construct(new CachingRecursiveIterator(new ParentIterator(new RecursiveDirectoryIterator($path)), true), 1);
+               RecursiveIteratorIterator::__construct(new CachingRecursiveIterator(new ParentIterator(new RecursiveDirectoryIterator($path)), true, true), 1);
        }
 }
 
index 6465f51253dfad601b6754c4dd77de7874e2efa1..3accacae43f94e500d9028af29f691fa95847e61 100644 (file)
@@ -4,7 +4,7 @@ class DirectoryTreeIterator extends RecursiveIteratorIterator
 {
        function __construct($path)
        {
-               parent::__construct(new CachingRecursiveIterator(new RecursiveDirectoryIterator($path), true), 1);
+               parent::__construct(new CachingRecursiveIterator(new RecursiveDirectoryIterator($path), true, true), 1);
        }
        
        function current()