| Total Complexity | 8 |
| Total Lines | 69 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | final class InfiniteEndRange extends RangeState |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var DateTimeInterface |
||
| 15 | */ |
||
| 16 | private $startDate; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param DateTimeInterface $startDate |
||
| 20 | */ |
||
| 21 | 10 | public function __construct(DateTimeInterface $startDate) |
|
| 22 | { |
||
| 23 | 10 | $this->startDate = $startDate; |
|
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * {@inheritdoc} |
||
| 28 | */ |
||
| 29 | 1 | public function hasStartDate(): bool |
|
| 30 | { |
||
| 31 | 1 | return true; |
|
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * {@inheritdoc} |
||
| 36 | */ |
||
| 37 | 1 | public function hasEndDate(): bool |
|
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * {@inheritdoc} |
||
| 44 | */ |
||
| 45 | 2 | public function getStartDate(): DateTimeInterface |
|
| 46 | { |
||
| 47 | 2 | return $this->startDate; |
|
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * {@inheritdoc} |
||
| 52 | */ |
||
| 53 | 1 | public function getEndDate(): DateTimeInterface |
|
| 54 | { |
||
| 55 | 1 | throw new DateRangeException('Range end is undefined'); |
|
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * {@inheritdoc} |
||
| 60 | */ |
||
| 61 | 1 | public function setStartDate(DateTimeInterface $start): RangeState |
|
| 62 | { |
||
| 63 | 1 | return new InfiniteEndRange($start); |
|
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * {@inheritdoc} |
||
| 68 | */ |
||
| 69 | 8 | public function setEndDate(DateTimeInterface $end): RangeState |
|
| 70 | { |
||
| 71 | 8 | return new FiniteRange($this->startDate, $end); |
|
| 72 | } |
||
| 73 | |||
| 74 | /** |
||
| 75 | * {@inheritdoc} |
||
| 76 | */ |
||
| 77 | 1 | public function formatEndDate(string $format = 'c'): ?string |
|
| 80 | } |
||
| 81 | } |
||
| 82 |