1 | <?php |
||
17 | class AccumulateIterator implements FiniteIterableInterface |
||
18 | { |
||
19 | use FiniteIterableTrait; |
||
20 | |||
21 | /** @var \Iterator */ |
||
22 | protected $iterable; |
||
23 | |||
24 | /** @var \Closure */ |
||
25 | protected $func; |
||
26 | |||
27 | /** @var mixed */ |
||
28 | protected $value; |
||
29 | |||
30 | /** |
||
31 | * AccumulateIterator constructor. |
||
32 | * |
||
33 | * @param \Iterator $iterable |
||
34 | * @param \Closure $func |
||
35 | */ |
||
36 | 12 | public function __construct(\Iterator $iterable, \Closure $func) |
|
42 | |||
43 | /** |
||
44 | * @{inheritDoc} |
||
45 | */ |
||
46 | 11 | public function rewind() |
|
51 | |||
52 | /** |
||
53 | * @{inheritDoc} |
||
54 | */ |
||
55 | 9 | public function current() |
|
59 | |||
60 | /** |
||
61 | * @{inheritDoc} |
||
62 | */ |
||
63 | 9 | public function key() |
|
67 | |||
68 | /** |
||
69 | * @{inheritDoc} |
||
70 | */ |
||
71 | 9 | public function next() |
|
82 | |||
83 | /** |
||
84 | * @{inheritDoc} |
||
85 | */ |
||
86 | 11 | public function valid() |
|
90 | } |
||
91 |