From: Marcus Boerger Date: Sun, 2 May 2004 22:07:32 +0000 (+0000) Subject: Update examples X-Git-Tag: RELEASE_0_1~306 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e72a305091f309e5b125f9537f45414a09924ae5;p=php Update examples --- diff --git a/ext/spl/examples/cachingiterator.inc b/ext/spl/examples/cachingiterator.inc index 6a20652341..ac2476f1f8 100644 --- a/ext/spl/examples/cachingiterator.inc +++ b/ext/spl/examples/cachingiterator.inc @@ -8,14 +8,14 @@ class CachingIterator protected $it; protected $current; protected $key; - protected $more; + protected $valid; protected $strValue; - protected $getStrVal; function __construct(Iterator $it, $flags = CIT_CALL_TOSTRING) { $this->it = $it; $this->flags = $flags & (CIT_CALL_TOSTRING|CIT_CATCH_GET_CHILD); + $this->next(); } function rewind() @@ -26,7 +26,7 @@ class CachingIterator function next() { - if ($this->more = $this->it->valid()) { + if ($this->valid = $this->it->valid()) { $this->current = $this->it->current(); $this->key = $this->it->key(); if ($this->flags & CIT_CALL_TOSTRING) { @@ -46,7 +46,7 @@ class CachingIterator function valid() { - return $this->more; + return $this->valid; } function hasNext() diff --git a/ext/spl/examples/cachingrecursiveiterator.inc b/ext/spl/examples/cachingrecursiveiterator.inc index dfeeea54e7..fc7d9a7220 100644 --- a/ext/spl/examples/cachingrecursiveiterator.inc +++ b/ext/spl/examples/cachingrecursiveiterator.inc @@ -4,13 +4,19 @@ class CachingRecursiveIterator extends CachingIterator implements RecursiveItera { protected $hasChildren; protected $getChildren; - protected $catch_get_child; function __construct(RecursiveIterator $it, $flags = CIT_CALL_TOSTRING) { parent::__construct($it, $flags); } + function rewind(); + { + $this->hasChildren = false; + $this->getChildren = NULL; + parent::rewind(); + } + function next() { if ($this->hasChildren = $this->it->hasChildren()) {