mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-12-04 12:18:30 +00:00
d7556b1d96
Change-Id: I729d5ff5afd4d45022fa0a4e42d060d35543b567
19 lines
423 B
PHP
19 lines
423 B
PHP
<?php
|
|
|
|
/**
|
|
* Applies a callback to all values returned from the iterator
|
|
*/
|
|
class EchoCallbackIterator extends EchoIteratorDecorator {
|
|
/** @var callable */
|
|
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() );
|
|
}
|
|
}
|