Back to index

php5  5.3.10
filteriterator.inc
Go to the documentation of this file.
00001 <?php
00002 
00026 abstract class FilterIterator implements OuterIterator
00027 {
00028        private $it;
00029 
00035        function __construct(Iterator $it) {
00036               $this->it = $it;
00037        }
00038 
00042        function rewind() {  
00043               $this->it->rewind();
00044               $this->fetch();
00045        }
00046 
00054        abstract function accept();
00055 
00061        protected function fetch() {
00062               while ($this->it->valid()) {
00063                      if ($this->accept()) {
00064                             return;
00065                      }
00066                      $this->it->next();
00067               };
00068        }
00069 
00075        function next() {
00076               $this->it->next();
00077               $this->fetch();
00078        }
00079        
00083        function valid() {
00084               return $this->it->valid();
00085        }
00086        
00090        function key() {
00091               return $this->it->key();
00092        }
00093        
00097        function current() {
00098               return $this->it->current();
00099        }
00100        
00104        protected function __clone() {
00105               // disallow clone 
00106        }
00107 
00111        function getInnerIterator()
00112        {
00113               return $this->it;
00114        }
00115 
00121        function __call($func, $params)
00122        {
00123               return call_user_func_array(array($this->it, $func), $params);
00124        }
00125 }
00126 
00127 ?>