1 | <?php |
||
12 | class LocalTimeslot |
||
13 | { |
||
14 | /** |
||
15 | * @var LocalDate |
||
16 | * |
||
17 | * @PeekAndPoke\Component\Slumber\Annotation\Slumber\AsLocalDate() |
||
18 | */ |
||
19 | private $from; |
||
20 | |||
21 | /** |
||
22 | * @var LocalDate |
||
23 | * |
||
24 | * @PeekAndPoke\Component\Slumber\Annotation\Slumber\AsLocalDate() |
||
25 | */ |
||
26 | private $to; |
||
27 | |||
28 | /** |
||
29 | * @return LocalTimeslot |
||
30 | */ |
||
31 | 14 | public static function createEmpty() |
|
35 | |||
36 | /** |
||
37 | * @param LocalDate $from |
||
38 | * @param LocalDate $to |
||
39 | * |
||
40 | * @return LocalTimeslot |
||
41 | */ |
||
42 | 10 | public static function from(LocalDate $from, LocalDate $to) |
|
50 | |||
51 | /** |
||
52 | * LocalTimeslot cannot be constructed directly. |
||
53 | * |
||
54 | * @see from() |
||
55 | * @see createEmpty() |
||
56 | */ |
||
57 | 24 | protected function __construct() |
|
60 | |||
61 | /** |
||
62 | * @return string |
||
63 | */ |
||
64 | 4 | public function __toString() |
|
68 | |||
69 | /** |
||
70 | * @return bool |
||
71 | */ |
||
72 | 9 | public function isValid() |
|
78 | |||
79 | /** |
||
80 | * @param LocalTimeslot $other |
||
81 | * |
||
82 | * @return bool |
||
83 | */ |
||
84 | 9 | public function equals(LocalTimeslot $other = null) |
|
104 | |||
105 | /** |
||
106 | * @return LocalDate |
||
107 | */ |
||
108 | 10 | public function getFrom() |
|
112 | |||
113 | /** |
||
114 | * @return LocalDate |
||
115 | */ |
||
116 | 10 | public function getTo() |
|
120 | |||
121 | /** |
||
122 | * @param LocalDate $from |
||
123 | * |
||
124 | * @return $this |
||
125 | */ |
||
126 | 12 | public function setFrom(LocalDate $from = null) |
|
132 | |||
133 | /** |
||
134 | * @param LocalDate $to |
||
135 | * |
||
136 | * @return $this |
||
137 | */ |
||
138 | 12 | public function setTo(LocalDate $to = null) |
|
144 | |||
145 | /** |
||
146 | * Creates a new instance and moves the timeslot by the given number of hours |
||
147 | * |
||
148 | * @param float $numHours |
||
149 | * |
||
150 | * @return LocalTimeslot |
||
151 | */ |
||
152 | 3 | public function modifyByHours($numHours) |
|
159 | |||
160 | /** |
||
161 | * Creates a new instance and moves the timeslot by the given number of days |
||
162 | * |
||
163 | * @param int $numDays |
||
164 | * |
||
165 | * @return LocalTimeslot |
||
166 | */ |
||
167 | 3 | public function modifyByDays($numDays) |
|
174 | |||
175 | /** |
||
176 | * Creates a new instance and moves the timeslot by the given number of days |
||
177 | * Takes into consideration the daylight savings possible issues |
||
178 | * |
||
179 | * @param int $numDays |
||
180 | * |
||
181 | * @return LocalTimeslot |
||
182 | */ |
||
183 | 3 | public function modifyByDaysDaylightSavingAware($numDays) |
|
190 | |||
191 | /** |
||
192 | * @return int |
||
193 | */ |
||
194 | 2 | public function getDurationInSecs() |
|
202 | |||
203 | /** |
||
204 | * @return float |
||
205 | */ |
||
206 | 2 | public function getDurationInMins() |
|
210 | } |
||
211 |