1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (http://nette.org)
5: *
6: * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
7: *
8: * For the full copyright and license information, please view
9: * the file license.txt that was distributed with this source code.
10: * @package Nette\Iterators
11: */
12:
13:
14:
15: /**
16: * Callback iterator filter.
17: *
18: * @author David Grudl
19: * @package Nette\Iterators
20: */
21: class NCallbackFilterIterator extends FilterIterator
22: {
23: /** @var callable */
24: private $callback;
25:
26:
27: public function __construct(Iterator $iterator, $callback)
28: {
29: parent::__construct($iterator);
30: $this->callback = new Callback($callback);
31: }
32:
33:
34: public function accept()
35: {
36: return $this->callback->invoke($this);
37: }
38:
39: }
40: