| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Extension\Notifications\Iterator; |
| 4 |
|
| 5 |
use Iterator; |
| 6 |
use IteratorDecorator; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
class CallbackIterator extends IteratorDecorator { |
| 12 |
|
| 13 |
protected $callable; |
| 14 |
|
| 15 |
public function __construct( Iterator $iterator, $callable ) { |
| 16 |
parent::__construct( $iterator ); |
| 17 |
$this->callable = $callable; |
| 18 |
} |
| 19 |
|
| 20 |
public function current() { |
| 21 |
return call_user_func( $this->callable, $this->iterator->current() ); |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
class_alias( CallbackIterator::class, 'EchoCallbackIterator' ); |