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