mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-25 00:05:29 +00:00
18 lines
401 B
PHP
18 lines
401 B
PHP
|
<?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() );
|
||
|
}
|
||
|
}
|