diff options
author | SVN Migration <svn@php.net> | 2004-01-25 12:03:25 +0000 |
---|---|---|
committer | SVN Migration <svn@php.net> | 2004-01-25 12:03:25 +0000 |
commit | 22476b36ce621bdd115493bab84cbe706e422a7c (patch) | |
tree | 1124d1c5af68860a78c2252bb0dac63c9f18156e /ext/spl/examples/cachingiterator.inc | |
parent | eb7aca4ea896b09cb9afc2466a46f4720acc4a4e (diff) | |
download | php-git-php_ibase_before_split.tar.gz |
This commit was manufactured by cvs2svn to create tagphp_ibase_before_split
'php_ibase_before_split'.
Diffstat (limited to 'ext/spl/examples/cachingiterator.inc')
-rw-r--r-- | ext/spl/examples/cachingiterator.inc | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/ext/spl/examples/cachingiterator.inc b/ext/spl/examples/cachingiterator.inc deleted file mode 100644 index d828b88e7b..0000000000 --- a/ext/spl/examples/cachingiterator.inc +++ /dev/null @@ -1,81 +0,0 @@ -<?php - -define('CIT_CALL_TOSTRING', 1); -define('CIT_CATCH_GET_CHILD', 2); - -class CachingIterator -{ - protected $it; - protected $current; - protected $key; - protected $more; - 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); - } - - function rewind() - { - $this->it->rewind(); - $this->next(); - } - - function next() - { - if ($this->more = $this->it->hasMore()) { - $this->current = $this->it->current(); - $this->key = $this->it->key(); - if ($this->flags & CIT_CALL_TOSTRING) { - if (is_object($this->current)) { - $this->strValue = $this->current->__toString(); - } else { - $this->strValue = (string)$this->current; - } - } - } else { - $this->current = NULL; - $this->key = NULL; - $this->strValue = NULL; - } - $this->it->next(); - } - - function hasMore() - { - return $this->more; - } - - function hasNext() - { - return $this->it->hasMore(); - } - - function current() - { - return $this->current; - } - - function key() - { - return $this->key; - } - - function __call($func, $params) - { - return call_user_func_array(array($this->it, $func), $params); - } - - function __toString() - { - if (!$this->flags & CIT_CALL_TOSTRING) { - throw new exception('CachingIterator does not fetch string value (see CachingIterator::__construct)'); - } - return $this->strValue; - } -} - -?>
\ No newline at end of file |