1 | <?php |
||
10 | class TimeInterval implements TimeIntervalInterface |
||
11 | { |
||
12 | /** |
||
13 | * The start time. |
||
14 | * |
||
15 | * @var Time |
||
16 | */ |
||
17 | protected $start; |
||
18 | |||
19 | /** |
||
20 | * The end time. |
||
21 | * |
||
22 | * @var Time |
||
23 | */ |
||
24 | protected $end; |
||
25 | |||
26 | /** |
||
27 | * @param Time $start The start time. |
||
28 | * @param Time $end The end time. |
||
29 | * @throws \InvalidArgumentException If the opening time is not earlier than closing time. |
||
30 | */ |
||
31 | 102 | public function __construct(Time $start, Time $end) |
|
42 | |||
43 | /** |
||
44 | * Create a new interval from time strings. |
||
45 | * |
||
46 | * @param string $startTime The start time |
||
47 | * @param string $endTime The end time |
||
48 | * @return TimeInterval |
||
49 | * @throws \InvalidArgumentException |
||
50 | */ |
||
51 | 27 | public static function fromString($startTime, $endTime): self |
|
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | 99 | public function contains(Time $time): bool |
|
63 | |||
64 | /** |
||
65 | * {@inheritdoc} |
||
66 | */ |
||
67 | 135 | public function getStart(): Time |
|
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | 135 | public function getEnd(): Time |
|
79 | |||
80 | /** |
||
81 | * {@inheritdoc} |
||
82 | */ |
||
83 | 9 | public function jsonSerialize() |
|
90 | |||
91 | public function __clone() |
||
96 | } |
||
97 |