scratch – Blame information for rev 87

Subversion Repositories:
Rev:
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 InvalidArgumentException;
16 use Iterator;
17  
18 class SelectIterator extends \IteratorIterator
19 {
20 private $selector;
21  
22 public function __construct(Iterator $iterator, $selector)
23 {
24 parent::__construct($iterator);
25 if ($selector === null) {
26 throw new InvalidArgumentException("Selector must not be null.");
27 }
28  
29 $this->selector = $selector;
30 }
31  
32 public function current()
33 {
34 $selector = $this->selector;
35 return $selector(parent::current());
36 }
37 }