1 | <?php |
||
8 | class TimeInterval implements TimeIntervalInterface |
||
9 | { |
||
10 | /** |
||
11 | * The start time. |
||
12 | * |
||
13 | * @var Time |
||
14 | */ |
||
15 | protected $start; |
||
16 | |||
17 | /** |
||
18 | * The end time. |
||
19 | * |
||
20 | * @var Time |
||
21 | */ |
||
22 | protected $end; |
||
23 | |||
24 | /** |
||
25 | * Constructor. |
||
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 | 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 | public static function fromString($startTime, $endTime) |
||
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | public function contains(Time $time) |
||
63 | |||
64 | /** |
||
65 | * {@inheritdoc} |
||
66 | */ |
||
67 | public function getStart() |
||
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | public function getEnd() |
||
79 | |||
80 | /** |
||
81 | * {@inheritdoc} |
||
82 | */ |
||
83 | public function jsonSerialize() |
||
90 | } |
||
91 |