FiniteDateRangeProvider::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of Zee Project.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @see https://github.com/zee/
9
 */
10
11
namespace Zee\DateRange\Providers;
12
13
use DateTimeInterface;
14
use Zee\DateRange\DateRange;
15
use Zee\DateRange\DateRangeInterface;
16
use Zee\DateRange\DateRangeProvider;
17
18
/**
19
 * Finite date range provider.
20
 */
21
final class FiniteDateRangeProvider implements DateRangeProvider
22
{
23
    /**
24
     * @var DateTimeInterface
25
     */
26
    private $startDate;
27
28
    /**
29
     * @var DateTimeInterface
30
     */
31
    private $endDate;
32
33
    /**
34
     * @param DateTimeInterface $startDate
35
     * @param DateTimeInterface $endDate
36
     */
37 1
    public function __construct(DateTimeInterface $startDate, DateTimeInterface $endDate)
38
    {
39 1
        $this->startDate = $startDate;
40 1
        $this->endDate = $endDate;
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46 1
    public function getDateRange(): DateRangeInterface
47
    {
48 1
        return new DateRange($this->startDate, $this->endDate);
49
    }
50
}
51