Completed
Push — master ( ab9fdb...7d2071 )
by Veaceslav
02:00
created

UndefinedRange::getStartDate()   A

Complexity

Conditions 1
Paths 0

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 0
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Zee\DateRange\States;
4
5
use DateTimeInterface;
6
use Zee\DateRange\DateRangeException;
7
8
/**
9
 * Class UndefinedRange.
10
 */
11
final class UndefinedRange extends RangeState
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16 2
    public function getStartDate(): DateTimeInterface
17
    {
18 2
        throw new DateRangeException('Range start is undefined');
19
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24 2
    public function getEndDate(): DateTimeInterface
25
    {
26 2
        throw new DateRangeException('Range end is undefined');
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32 10
    public function setStartDate(DateTimeInterface $start): RangeState
33
    {
34 10
        return new InfiniteEndRange($start);
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40 3
    public function setEndDate(DateTimeInterface $end): RangeState
41
    {
42 3
        return new InfiniteStartRange($end);
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48 1
    public function formatStartDate(string $format = 'c'): ?string
49
    {
50 1
        return null;
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56 1
    public function formatEndDate(string $format = 'c'): ?string
57
    {
58 1
        return null;
59
    }
60
}
61