Debian Codegraph @

extensions/Echo/includes/Iterator/CallbackIterator.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Extension\Notifications\Iterator;
4
5 use Iterator;
6 use IteratorDecorator;
7
8 /**
9 * Applies a callback to all values returned from the iterator
10 */
11 class CallbackIterator extends IteratorDecorator {
12 /** @var callable */
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' );