IntervalIterator::rewind()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php declare(strict_types = 1);
2
3
namespace IntervalParser;
4
5
class IntervalIterator implements \Iterator
6
{
7
    private $intervals = [];
8
9 5
    public function __construct(array $intervals)
10
    {
11 5
        $this->intervals = $intervals;
12
    }
13
14 1
    public function rewind()
15
    {
16 1
        reset($this->intervals);
17
    }
18
19 3
    public function current()
20
    {
21 3
        return current($this->intervals);
22
    }
23
24 1
    public function key()
25
    {
26 1
        return key($this->intervals);
27
    }
28
29 4
    public function next()
30
    {
31 4
        return next($this->intervals);
32
    }
33
34 1
    public function valid()
35
    {
36 1
        return key($this->intervals) !== null;
37
    }
38
}
39