IntervalIterator   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 34
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A rewind() 0 4 1
A current() 0 4 1
A key() 0 4 1
A next() 0 4 1
A valid() 0 4 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