3
* Iterator for arrays requiring filtered values
6
* @subpackage Utilities
10
* Iterator for arrays requiring filtered values
13
* @subpackage Utilities
15
class Requests_Utility_FilteredIterator extends ArrayIterator {
17
* Callback to run as a filter
24
* Create a new iterator
27
* @param callable $callback Callback to be called on each value
29
public function __construct($data, $callback) {
30
parent::__construct($data);
32
$this->callback = $callback;
36
* Get the current item's value after filtering
40
public function current() {
41
$value = parent::current();
42
$value = call_user_func($this->callback, $value);