blob: c4b7926b162d5a559b42a01226610467fbec9ba2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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() );
}
}
|