Completed
Push — master ( 35fe2c...cfa2d2 )
by Veaceslav
03:15
created

UndefinedRange::setEndTime()   A

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
 * Class UndefinedRange.
10
 */
11
class UndefinedRange implements RangeState
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16 1
    public function __toString(): string
17
    {
18 1
        return '-/-';
19
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24 1
    public function jsonSerialize(): array
25
    {
26 1
        return ['startTime' => null, 'endTime' => null];
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32 1
    public function hasStartTime(): bool
33
    {
34 1
        return false;
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40 1
    public function hasEndTime(): bool
41
    {
42 1
        return false;
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48 1
    public function getStartTime(): DateTimeInterface
49
    {
50 1
        throw new DateRangeException('Date range is undefined');
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56 1
    public function getEndTime(): DateTimeInterface
57
    {
58 1
        throw new DateRangeException('Date range is undefined');
59
    }
60
61
    /**
62
     * {@inheritdoc}
63
     */
64 7
    public function setStartTime(DateTimeInterface $time): RangeState
65
    {
66 7
        return new InfiniteEndRange($time);
67
    }
68
69
    /**
70
     * {@inheritdoc}
71
     */
72 3
    public function setEndTime(DateTimeInterface $time): RangeState
73
    {
74 3
        return new InfiniteStartRange($time);
75
    }
76
77
    /**
78
     * {@inheritdoc}
79
     */
80 2
    public function isStartAt(DateTimeInterface $time): bool
81
    {
82 2
        return false;
83
    }
84
85
    /**
86
     * {@inheritdoc}
87
     */
88 2
    public function isEndAt(DateTimeInterface $time): bool
89
    {
90 2
        return false;
91
    }
92
93
    /**
94
     * {@inheritdoc}
95
     */
96 1
    public function isStarted(): bool
97
    {
98 1
        return false;
99
    }
100
101
    /**
102
     * {@inheritdoc}
103
     */
104 2
    public function isEnded(): bool
105
    {
106 2
        return false;
107
    }
108
}
109