diff options
author | Arnaud Le Blanc <lbarnaud@php.net> | 2011-03-27 20:13:27 +0000 |
---|---|---|
committer | Arnaud Le Blanc <lbarnaud@php.net> | 2011-03-27 20:13:27 +0000 |
commit | b83e243c23daafdecaec75461b5ff4705733608d (patch) | |
tree | 5b47dc4a3e42eafa3dcf833266928a549c375e1b /makerpm | |
parent | 2191af9546632c2eca7084e7e66745ff6ad7dd1a (diff) | |
download | php-git-b83e243c23daafdecaec75461b5ff4705733608d.tar.gz |
Added CallbackFilterIterator and RecursiveCallbackFilterIterator classes
[DOC] This is a concrete FilterIterator which takes a callback as
constructor parameter, and uses this callback for filtering. This allows
to use FilterIterator without extending it.
CallbackFilterIterator Example:
$it = new ArrayIterator(range(1,100));
$it = new CallbackFilterIterator($it, function($value) {
return $value % 2;
});
foreach($it as $value) // ...
RecursiveCallbackFilterIterator Example:
$it = new RecursiveDirectoryIterator("/");
$it = new RecursiveCallbackFilterIterator($it, function($file, $k, $it) {
return $it->hasChildren() || $file->getSize() > 1024;
});
foreach(new RecursiveIteratorIterator($it) as $file) // ...
The callback takes the current value, the current key and the inner
iterator as parameters.
Diffstat (limited to 'makerpm')
0 files changed, 0 insertions, 0 deletions