DateRange::__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 1
Bugs 0 Features 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 1
b 0
f 0
ccs 3
cts 3
cp 1
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Shlinkio\Shlink\Common\Util;
6
7
use Cake\Chronos\Chronos;
8
9
final class DateRange
10
{
11
    private ?Chronos $startDate;
12
    private ?Chronos $endDate;
13
14 6
    public function __construct(?Chronos $startDate = null, ?Chronos $endDate = null)
15
    {
16 6
        $this->startDate = $startDate;
17 6
        $this->endDate = $endDate;
18
    }
19
20 2
    public function getStartDate(): ?Chronos
21
    {
22 2
        return $this->startDate;
23
    }
24
25 2
    public function getEndDate(): ?Chronos
26
    {
27 2
        return $this->endDate;
28
    }
29
30 6
    public function isEmpty(): bool
31
    {
32 6
        return $this->startDate === null && $this->endDate === null;
33
    }
34
}
35