| Total Complexity | 7 |
| Total Lines | 62 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | final class DateRange |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var DateTimeInterface |
||
| 12 | */ |
||
| 13 | private $startDate; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var DateTimeInterface |
||
| 17 | */ |
||
| 18 | private $endDate; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @param DateTimeInterface $startDate |
||
| 22 | * @param DateTimeInterface $endDate |
||
| 23 | */ |
||
| 24 | public function __construct( |
||
| 25 | DateTimeInterface $startDate, |
||
| 26 | DateTimeInterface $endDate |
||
| 27 | ) { |
||
| 28 | $this->validateDateRange($startDate, $endDate); |
||
| 29 | |||
| 30 | $this->startDate = $startDate; |
||
| 31 | $this->endDate = $endDate; |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @return DateTimeInterface |
||
| 36 | */ |
||
| 37 | public function getStartDate(): DateTimeInterface |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @return DateTimeInterface |
||
| 44 | */ |
||
| 45 | public function getEndDate(): DateTimeInterface |
||
| 46 | { |
||
| 47 | return $this->endDate; |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @param DateTimeInterface $start |
||
| 52 | * @param DateTimeInterface $end |
||
| 53 | * @throws DateException |
||
| 54 | */ |
||
| 55 | private function validateDateRange(DateTimeInterface $start, DateTimeInterface $end) |
||
| 70 | } |
||
| 71 | } |
||
| 72 | } |
||
| 73 |