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) |
||
185 | |||
186 | |||
187 | /** |
||
188 | * retrieve all active global prices (that are not taxes (PBT_ID=4)) for a particular event |
||
189 | * |
||
190 | * @param boolean $count return count |
||
191 | * @return bool|EE_Base_Class[]|EE_PRice[] |
||
192 | * @throws EE_Error |
||
193 | */ |
||
194 | public function get_all_default_prices($count = false) |
||
207 | |||
208 | |||
209 | /** |
||
210 | * retrieve all prices that are taxes |
||
211 | * |
||
212 | * @return EE_Base_Class[]|EE_PRice[] |
||
213 | * @throws EE_Error |
||
214 | * @throws InvalidArgumentException |
||
215 | * @throws ReflectionException |
||
216 | * @throws InvalidDataTypeException |
||
217 | * @throws InvalidInterfaceException |
||
218 | */ |
||
219 | public function get_all_prices_that_are_taxes() |
||
233 | |||
234 | |||
235 | /** |
||
236 | * retrieve all prices for an ticket plus default global prices, but not taxes |
||
237 | * |
||
238 | * @param int $TKT_ID the id of the event. If not included then we assume that this is a new ticket. |
||
239 | * @return EE_Base_Class[]|EE_PRice[]|boolean |
||
240 | * @throws EE_Error |
||
241 | */ |
||
242 | public function get_all_ticket_prices_for_admin($TKT_ID = 0) |
||
278 | |||
279 | |||
280 | /** |
||
281 | * _sort_event_prices_by_type |
||
282 | * |
||
283 | * @param EE_Price $price_a |
||
284 | * @param EE_Price $price_b |
||
285 | * @return bool false on fail |
||
286 | */ |
||
287 | public function _sort_event_prices_by_type(EE_Price $price_a, EE_Price $price_b) |
||
294 | |||
295 | |||
296 | /** |
||
297 | * _sort_event_prices_by_order |
||
298 | * |
||
299 | * @param EE_Price $price_a |
||
300 | * @param EE_Price $price_b |
||
301 | * @return bool false on fail |
||
302 | */ |
||
303 | public function _sort_event_prices_by_order(EE_Price $price_a, EE_Price $price_b) |
||
310 | |||
311 | |||
312 | /** |
||
313 | * get all prices of a specific type |
||
314 | * |
||
315 | * @param int $type - PRT_ID |
||
316 | * @return EE_Base_Class[]|EE_PRice[] |
||
317 | * @throws EE_Error |
||
318 | */ |
||
319 | public function get_all_prices_that_are_type($type = 0) |
||
328 | |||
329 | |||
330 | /** |
||
331 | * Returns an array of the normal 'order_by' query parameter provided to the get_all query. |
||
332 | * Of course you don't have to use it, but this is the order we usually want to sort prices by |
||
333 | * |
||
334 | * @return array which can be used like so: $this->get_all(array(array(...where |
||
335 | * stuff...),'order_by'=>$this->_order_by_array_for_get_all_method())); |
||
336 | */ |
||
337 | public function _order_by_array_for_get_all_method() |
||
345 | } |
||
346 |
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.