summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Legler <alex@a3li.li>2015-08-15 13:31:50 +0200
committerAlex Legler <alex@a3li.li>2015-08-15 13:31:50 +0200
commit4e274d63f1e67d70ff0e862765aed816efed088e (patch)
tree124e586170c1ef5a4bea76a683428c35613f1323 /Echo/includes/iterator/CallbackIterator.php
parentUpdate MLEB (diff)
downloadextensions-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.php17
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() );
+ }
+}