Implementation of a Zipper, for efficient splice.
[htmlpurifier/darkodev.git] / library / HTMLPurifier / PropertyListIterator.php
blob15b330ea308e63de24e3f05f1546e4f539837d70
1 <?php
3 /**
4 * Property list iterator. Do not instantiate this class directly.
5 */
6 class HTMLPurifier_PropertyListIterator extends FilterIterator
9 /**
10 * @type int
12 protected $l;
13 /**
14 * @type string
16 protected $filter;
18 /**
19 * @param Iterator $iterator Array of data to iterate over
20 * @param string $filter Optional prefix to only allow values of
22 public function __construct(Iterator $iterator, $filter = null)
24 parent::__construct($iterator);
25 $this->l = strlen($filter);
26 $this->filter = $filter;
29 /**
30 * @return bool
32 public function accept()
34 $key = $this->getInnerIterator()->key();
35 if (strncmp($key, $this->filter, $this->l) !== 0) {
36 return false;
38 return true;
42 // vim: et sw=4 sts=4