File indexing completed on 2024-05-05 06:02:16

0001 <?php
0002 
0003 /**
0004  * Property list iterator. Do not instantiate this class directly.
0005  */
0006 class HTMLPurifier_PropertyListIterator extends FilterIterator
0007 {
0008 
0009     /**
0010      * @type int
0011      */
0012     protected $l;
0013     /**
0014      * @type string
0015      */
0016     protected $filter;
0017 
0018     /**
0019      * @param Iterator $iterator Array of data to iterate over
0020      * @param string $filter Optional prefix to only allow values of
0021      */
0022     public function __construct(Iterator $iterator, $filter = null)
0023     {
0024         parent::__construct($iterator);
0025         $this->l = strlen($filter);
0026         $this->filter = $filter;
0027     }
0028 
0029     /**
0030      * @return bool
0031      */
0032     public function accept()
0033     {
0034         $key = $this->getInnerIterator()->key();
0035         if (strncmp($key, $this->filter, $this->l) !== 0) {
0036             return false;
0037         }
0038         return true;
0039     }
0040 }
0041 
0042 // vim: et sw=4 sts=4