KeylessAppendIterator::next()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 10
cc 2
nc 2
nop 0
crap 2
1
<?php
2
/**
3
 * File was created 12.06.2015 09:31
4
 *
5
 * @author Karsten J. Gerber <[email protected]>
6
 */
7
8
namespace PeekAndPoke\Component\Psi\Iterator;
9
10
/**
11
 * @author Karsten J. Gerber <[email protected]>
12
 */
13
class KeylessAppendIterator extends \AppendIterator
14
{
15
    /** @var int */
16
    private $key;
17
18 5
    public function rewind()
19
    {
20 5
        $this->key = 0;
21
22 5
        parent::rewind();
23 5
    }
24
25 5
    public function next()
26
    {
27 5
        if ($this->valid()) {
28 5
            parent::next();
29 5
            ++$this->key;
30
        }
31 5
    }
32
33
    /**
34
     * @return int
35
     */
36 5
    public function key()
37
    {
38 5
        return $this->key;
39
    }
40
}
41