diff options
author | Alex Legler <alex@a3li.li> | 2015-08-15 13:31:50 +0200 |
---|---|---|
committer | Alex Legler <alex@a3li.li> | 2015-08-15 13:31:50 +0200 |
commit | 4e274d63f1e67d70ff0e862765aed816efed088e (patch) | |
tree | 124e586170c1ef5a4bea76a683428c35613f1323 /Echo/includes/iterator/CallbackIterator.php | |
parent | Update MLEB (diff) | |
download | extensions-4e274d63f1e67d70ff0e862765aed816efed088e.tar.gz extensions-4e274d63f1e67d70ff0e862765aed816efed088e.tar.bz2 extensions-4e274d63f1e67d70ff0e862765aed816efed088e.zip |
Add Echo
Diffstat (limited to 'Echo/includes/iterator/CallbackIterator.php')
-rw-r--r-- | Echo/includes/iterator/CallbackIterator.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Echo/includes/iterator/CallbackIterator.php b/Echo/includes/iterator/CallbackIterator.php new file mode 100644 index 00000000..c4b7926b --- /dev/null +++ b/Echo/includes/iterator/CallbackIterator.php @@ -0,0 +1,17 @@ +<?php + +/** + * Applies a callback to all values returned from the iterator + */ +class EchoCallbackIterator extends EchoIteratorDecorator { + protected $callable; + + public function __construct( Iterator $iterator, $callable ) { + parent::__construct( $iterator ); + $this->callable = $callable; + } + + public function current() { + return call_user_func( $this->callable, $this->iterator->current() ); + } +} |