1 | <?php |
||
13 | class EEM_Price extends EEM_Soft_Delete_Base |
||
14 | { |
||
15 | |||
16 | // private instance of the EEM_Price object |
||
17 | protected static $_instance; |
||
18 | |||
19 | |||
20 | /** |
||
21 | * private constructor to prevent direct creation |
||
22 | * |
||
23 | * @Constructor |
||
24 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings |
||
25 | * (and any incoming timezone data that gets saved). |
||
26 | * Note this just sends the timezone info to the date time model field objects. |
||
27 | * Default is NULL |
||
28 | * (and will be assumed using the set timezone in the 'timezone_string' wp option) |
||
29 | */ |
||
30 | protected function __construct($timezone) |
||
142 | |||
143 | |||
144 | /** |
||
145 | * instantiate a new price object with blank/empty properties |
||
146 | * |
||
147 | * @return mixed array on success, FALSE on fail |
||
148 | */ |
||
149 | public function get_new_price() |
||
153 | |||
154 | |||
155 | /** |
||
156 | * retrieve ALL prices from db |
||
157 | * |
||
158 | * @return EE_Base_Class[]|EE_PRice[] |
||
159 | * @throws EE_Error |
||
160 | */ |
||
161 | public function get_all_prices() |
||
166 | |||
167 | |||
168 | /** |
||
169 | * retrieve all active prices for a particular event |
||
170 | * |
||
171 | * @param int $EVT_ID |
||
172 | * @return array on success |
||
173 | * @throws EE_Error |
||
174 | */ |
||
175 | public function get_all_event_prices($EVT_ID = 0) |
||
187 | |||
188 | |||
189 | /** |
||
190 | * retrieve all active global prices (that are not taxes (PBT_ID=4)) for a particular event |
||
191 | * |
||
192 | * @param boolean $count return count |
||
193 | * @param bool $include_taxes |
||
194 | * @return bool|EE_Base_Class[]|EE_PRice[] |
||
195 | * @throws EE_Error |
||
196 | */ |
||
197 | public function get_all_default_prices($count = false, $include_taxes = false) |
||
212 | |||
213 | |||
214 | /** |
||
215 | * retrieve all active global prices that are taxes |
||
216 | * |
||
217 | * @return bool|EE_Base_Class[]|EE_PRice[] |
||
218 | * @throws EE_Error |
||
219 | * @since $VID:$ |
||
220 | */ |
||
221 | public function getAllDefaultTaxes() |
||
237 | |||
238 | |||
239 | /** |
||
240 | * retrieve all prices that are taxes |
||
241 | * |
||
242 | * @return EE_Base_Class[]|EE_PRice[] |
||
243 | * @throws EE_Error |
||
244 | * @throws InvalidArgumentException |
||
245 | * @throws ReflectionException |
||
246 | * @throws InvalidDataTypeException |
||
247 | * @throws InvalidInterfaceException |
||
248 | */ |
||
249 | public function get_all_prices_that_are_taxes() |
||
265 | |||
266 | |||
267 | /** |
||
268 | * retrieve all prices for an ticket plus default global prices, but not taxes |
||
269 | * |
||
270 | * @param int $TKT_ID the id of the event. If not included then we assume that this is a new ticket. |
||
271 | * @return EE_Base_Class[]|EE_PRice[]|boolean |
||
272 | * @throws EE_Error |
||
273 | */ |
||
274 | public function get_all_ticket_prices_for_admin($TKT_ID = 0) |
||
312 | |||
313 | |||
314 | /** |
||
315 | * _sort_event_prices_by_type |
||
316 | * |
||
317 | * @param EE_Price $price_a |
||
318 | * @param EE_Price $price_b |
||
319 | * @return bool false on fail |
||
320 | */ |
||
321 | public function _sort_event_prices_by_type(EE_Price $price_a, EE_Price $price_b) |
||
328 | |||
329 | |||
330 | /** |
||
331 | * _sort_event_prices_by_order |
||
332 | * |
||
333 | * @param EE_Price $price_a |
||
334 | * @param EE_Price $price_b |
||
335 | * @return bool false on fail |
||
336 | */ |
||
337 | public function _sort_event_prices_by_order(EE_Price $price_a, EE_Price $price_b) |
||
344 | |||
345 | |||
346 | /** |
||
347 | * get all prices of a specific type |
||
348 | * |
||
349 | * @param int $type - PRT_ID |
||
350 | * @return EE_Base_Class[]|EE_PRice[] |
||
351 | * @throws EE_Error |
||
352 | */ |
||
353 | public function get_all_prices_that_are_type($type = 0) |
||
364 | |||
365 | |||
366 | /** |
||
367 | * Returns an array of the normal 'order_by' query parameter provided to the get_all query. |
||
368 | * Of course you don't have to use it, but this is the order we usually want to sort prices by |
||
369 | * |
||
370 | * @return array which can be used like so: $this->get_all(array(array(...where |
||
371 | * stuff...),'order_by'=>$this->_order_by_array_for_get_all_method())); |
||
372 | */ |
||
373 | public function _order_by_array_for_get_all_method() |
||
381 | } |
||
382 |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.