scratch – Blame information for rev
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
87 | office | 1 | <?php |
2 | |||
3 | /* |
||
4 | * This file is part of Fusonic-linq. |
||
5 | * https://github.com/fusonic/fusonic-linq |
||
6 | * |
||
7 | * (c) Fusonic GmbH |
||
8 | * |
||
9 | * For the full copyright and license information, please view the LICENSE |
||
10 | * file that was distributed with this source code. |
||
11 | */ |
||
12 | |||
13 | namespace Fusonic\Linq\Iterator; |
||
14 | |||
15 | use Iterator; |
||
16 | use Fusonic\Linq\Helper; |
||
17 | |||
18 | class WhereIterator extends \FilterIterator |
||
19 | { |
||
20 | private $func; |
||
21 | |||
22 | public function __construct(Iterator $iterator, $func) |
||
23 | { |
||
24 | parent::__construct($iterator); |
||
25 | $this->func = $func; |
||
26 | } |
||
27 | |||
28 | public function accept() |
||
29 | { |
||
30 | $func = $this->func; |
||
31 | $current = $this->current(); |
||
32 | return Helper\LinqHelper::getBoolOrThrowException($func($current)); |
||
33 | } |
||
34 | } |