DateRangeIterator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 22
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A next() 0 4 1
A rewind() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Adlogix\EventScheduler\DateRange;
6
7
use DateInterval;
8
9
/**
10
 * @author Toni Van de Voorde <[email protected]>
11
 */
12
final class DateRangeIterator extends AbstractDateRangeIterator
13
{
14
    /**
15
     * @param DateRange         $dateRange
16
     * @param DateInterval|null $interval
17
     */
18 5
    public function __construct(DateRange $dateRange, DateInterval $interval = null)
19
    {
20 5
        parent::__construct($dateRange, $interval);
21 5
        $this->current = $dateRange->startDate();
22 5
    }
23
24 5
    public function next()
25
    {
26 5
        $this->current = $this->current->add($this->interval);
27 5
        $this->key++;
28 5
    }
29
30 4
    public function rewind()
31
    {
32 4
        $this->key = 0;
33 4
        $this->current = $this->dateRange->startDate();
34 4
    }
35
}
36