Back to index

php5  5.3.10
iteratoriterator.inc
Go to the documentation of this file.
00001 <?php
00002 
00040 class IteratorIterator implements OuterIterator
00041 {
00047        function __construct(Traversable $iterator, $classname = null)
00048        {
00049               if ($iterator instanceof IteratorAggregate)
00050               {
00051                   $iterator = $iterator->getIterator();
00052               }
00053               if ($iterator instanceof Iterator)
00054               {
00055                      $this->iterator = $iterator;
00056               }
00057               else
00058               {
00059                      throw new Exception("Classes that only implement Traversable can be wrapped only after converting class IteratorIterator into c code");
00060               }
00061        }
00062 
00065        function getInnerIterator()
00066        {
00067               return $this->iterator;
00068        }
00069 
00072        function valid()
00073        {
00074               return $this->iterator->valid();
00075        }
00076 
00079        function key()
00080        {
00081               return $this->iterator->key();
00082        }
00083 
00086        function current()
00087        {
00088               return $this->iterator->current();
00089        }
00090 
00093        function next()
00094        {
00095               return $this->iterator->next();
00096        }
00097 
00100        function rewind()
00101        {
00102               return $this->iterator->rewind();
00103        }
00104 
00110        function __call($func, $params)
00111        {
00112               return call_user_func_array(array($this->iterator, $func), $params);
00113        }
00114 
00118        private $iterator;
00119 }
00120 
00121 ?>