blob: 065996105570cf256c3275a460dbabc9aea9abef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
<?php
/* Icinga Web 2 | (c) 2014 Icinga Development Team | GPLv2+ */
namespace Icinga\Util;
use FilterIterator;
/**
* Class EnumeratingFilterIterator
*
* FilterIterator with continuous numeric key (index)
*/
abstract class EnumeratingFilterIterator extends FilterIterator
{
/**
* @var int
*/
private $index;
public function rewind(): void
{
parent::rewind();
$this->index = 0;
}
public function key(): int
{
return $this->index++;
}
}
|