UndefinedState::formatStartDate()   A
last analyzed

Complexity

Conditions 1
Paths 1

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 1
nop 1
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
 * State of the undefined range.
10
 */
11
final class UndefinedState 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 InfiniteEndState($start);
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40 4
    public function setEndDate(DateTimeInterface $end): RangeState
41
    {
42 4
        return new InfiniteStartState($end);
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48 3
    public function formatStartDate(string $format = 'c'): ?string
49
    {
50 3
        return null;
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56 3
    public function formatEndDate(string $format = 'c'): ?string
57
    {
58 3
        return null;
59
    }
60
}
61