Version 1
[yaffs-website] / vendor / symfony / polyfill-php54 / Resources / stubs / CallbackFilterIterator.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 class CallbackFilterIterator extends FilterIterator
13 {
14     private $iterator;
15     private $callback;
16
17     public function __construct(Iterator $iterator, $callback)
18     {
19         $this->iterator = $iterator;
20         $this->callback = $callback;
21         parent::__construct($iterator);
22     }
23
24     public function accept()
25     {
26         return call_user_func($this->callback, $this->current(), $this->key(), $this->iterator);
27     }
28 }