1 | <?php |
||
13 | class EE_Price extends EE_Soft_Delete_Base_Class |
||
14 | { |
||
15 | |||
16 | /** |
||
17 | * @param array $props_n_values incoming values |
||
18 | * @param string $timezone incoming timezone (if not set the timezone set for the website will be |
||
19 | * used.) |
||
20 | * @param array $date_formats incoming date_formats in an array where the first value is the |
||
21 | * date_format and the second value is the time format |
||
22 | * @return EE_Price |
||
23 | * @throws EE_Error |
||
24 | * @throws InvalidArgumentException |
||
25 | * @throws ReflectionException |
||
26 | * @throws InvalidDataTypeException |
||
27 | * @throws InvalidInterfaceException |
||
28 | */ |
||
29 | public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) |
||
34 | |||
35 | |||
36 | /** |
||
37 | * @param array $props_n_values incoming values from the database |
||
38 | * @param string $timezone incoming timezone as set by the model. If not set the timezone for |
||
39 | * the website will be used. |
||
40 | * @return EE_Price |
||
41 | * @throws EE_Error |
||
42 | * @throws InvalidArgumentException |
||
43 | * @throws ReflectionException |
||
44 | * @throws InvalidDataTypeException |
||
45 | * @throws InvalidInterfaceException |
||
46 | */ |
||
47 | public static function new_instance_from_db($props_n_values = array(), $timezone = null) |
||
51 | |||
52 | |||
53 | /** |
||
54 | * Set Price type ID |
||
55 | * |
||
56 | * @param int $PRT_ID |
||
57 | * @throws EE_Error |
||
58 | * @throws InvalidArgumentException |
||
59 | * @throws ReflectionException |
||
60 | * @throws InvalidDataTypeException |
||
61 | * @throws InvalidInterfaceException |
||
62 | */ |
||
63 | public function set_type($PRT_ID = 0) |
||
67 | |||
68 | |||
69 | /** |
||
70 | * Set Price Amount |
||
71 | * |
||
72 | * @param float $PRC_amount |
||
73 | * @throws EE_Error |
||
74 | * @throws InvalidArgumentException |
||
75 | * @throws ReflectionException |
||
76 | * @throws InvalidDataTypeException |
||
77 | * @throws InvalidInterfaceException |
||
78 | */ |
||
79 | public function set_amount($PRC_amount = 0.00) |
||
83 | |||
84 | |||
85 | /** |
||
86 | * Set Price Name |
||
87 | * |
||
88 | * @param string $PRC_name |
||
89 | * @throws EE_Error |
||
90 | * @throws InvalidArgumentException |
||
91 | * @throws ReflectionException |
||
92 | * @throws InvalidDataTypeException |
||
93 | * @throws InvalidInterfaceException |
||
94 | */ |
||
95 | public function set_name($PRC_name = '') |
||
99 | |||
100 | |||
101 | /** |
||
102 | * Set Price Description |
||
103 | * |
||
104 | * @param string $PRC_desc |
||
105 | * @throws EE_Error |
||
106 | * @throws InvalidArgumentException |
||
107 | * @throws ReflectionException |
||
108 | * @throws InvalidDataTypeException |
||
109 | * @throws InvalidInterfaceException |
||
110 | */ |
||
111 | public function set_description($PRC_desc = '') |
||
115 | |||
116 | |||
117 | /** |
||
118 | * set is_default |
||
119 | * |
||
120 | * @param bool $PRC_is_default |
||
121 | * @throws EE_Error |
||
122 | * @throws InvalidArgumentException |
||
123 | * @throws ReflectionException |
||
124 | * @throws InvalidDataTypeException |
||
125 | * @throws InvalidInterfaceException |
||
126 | */ |
||
127 | public function set_is_default($PRC_is_default = false) |
||
131 | |||
132 | |||
133 | /** |
||
134 | * set deleted |
||
135 | * |
||
136 | * @param bool $PRC_deleted |
||
137 | * @throws EE_Error |
||
138 | * @throws InvalidArgumentException |
||
139 | * @throws ReflectionException |
||
140 | * @throws InvalidDataTypeException |
||
141 | * @throws InvalidInterfaceException |
||
142 | */ |
||
143 | public function set_deleted($PRC_deleted = null) |
||
147 | |||
148 | |||
149 | /** |
||
150 | * get Price type |
||
151 | * |
||
152 | * @return int |
||
153 | * @throws EE_Error |
||
154 | * @throws InvalidArgumentException |
||
155 | * @throws ReflectionException |
||
156 | * @throws InvalidDataTypeException |
||
157 | * @throws InvalidInterfaceException |
||
158 | */ |
||
159 | public function type() |
||
163 | |||
164 | |||
165 | /** |
||
166 | * get Price Amount |
||
167 | * |
||
168 | * @return float |
||
169 | * @throws EE_Error |
||
170 | * @throws InvalidArgumentException |
||
171 | * @throws ReflectionException |
||
172 | * @throws InvalidDataTypeException |
||
173 | * @throws InvalidInterfaceException |
||
174 | */ |
||
175 | public function amount() |
||
179 | |||
180 | |||
181 | /** |
||
182 | * get Price Name |
||
183 | * |
||
184 | * @return string |
||
185 | * @throws EE_Error |
||
186 | * @throws InvalidArgumentException |
||
187 | * @throws ReflectionException |
||
188 | * @throws InvalidDataTypeException |
||
189 | * @throws InvalidInterfaceException |
||
190 | */ |
||
191 | public function name() |
||
195 | |||
196 | |||
197 | /** |
||
198 | * get Price description |
||
199 | * |
||
200 | * @return string |
||
201 | * @throws EE_Error |
||
202 | * @throws InvalidArgumentException |
||
203 | * @throws ReflectionException |
||
204 | * @throws InvalidDataTypeException |
||
205 | * @throws InvalidInterfaceException |
||
206 | */ |
||
207 | public function desc() |
||
211 | |||
212 | |||
213 | /** |
||
214 | * get overrides |
||
215 | * |
||
216 | * @return int |
||
217 | * @throws EE_Error |
||
218 | * @throws InvalidArgumentException |
||
219 | * @throws ReflectionException |
||
220 | * @throws InvalidDataTypeException |
||
221 | * @throws InvalidInterfaceException |
||
222 | */ |
||
223 | public function overrides() |
||
227 | |||
228 | |||
229 | /** |
||
230 | * get order |
||
231 | * |
||
232 | * @return int |
||
233 | * @throws EE_Error |
||
234 | * @throws InvalidArgumentException |
||
235 | * @throws ReflectionException |
||
236 | * @throws InvalidDataTypeException |
||
237 | * @throws InvalidInterfaceException |
||
238 | */ |
||
239 | public function order() |
||
243 | |||
244 | |||
245 | /** |
||
246 | * get the author of the price |
||
247 | * |
||
248 | * @return int |
||
249 | * @throws EE_Error |
||
250 | * @throws InvalidArgumentException |
||
251 | * @throws ReflectionException |
||
252 | * @throws InvalidDataTypeException |
||
253 | * @throws InvalidInterfaceException |
||
254 | * @since 4.5.0 |
||
255 | */ |
||
256 | public function wp_user() |
||
260 | |||
261 | |||
262 | /** |
||
263 | * get is_default |
||
264 | * |
||
265 | * @return bool |
||
266 | * @throws EE_Error |
||
267 | * @throws InvalidArgumentException |
||
268 | * @throws ReflectionException |
||
269 | * @throws InvalidDataTypeException |
||
270 | * @throws InvalidInterfaceException |
||
271 | */ |
||
272 | public function is_default() |
||
276 | |||
277 | |||
278 | /** |
||
279 | * get deleted |
||
280 | * |
||
281 | * @return bool |
||
282 | * @throws EE_Error |
||
283 | * @throws InvalidArgumentException |
||
284 | * @throws ReflectionException |
||
285 | * @throws InvalidDataTypeException |
||
286 | * @throws InvalidInterfaceException |
||
287 | */ |
||
288 | public function deleted() |
||
292 | |||
293 | |||
294 | /** |
||
295 | * @return bool |
||
296 | * @throws EE_Error |
||
297 | * @throws InvalidArgumentException |
||
298 | * @throws ReflectionException |
||
299 | * @throws InvalidDataTypeException |
||
300 | * @throws InvalidInterfaceException |
||
301 | */ |
||
302 | public function parent() |
||
306 | |||
307 | |||
308 | // some helper methods for getting info on the price_type for this price |
||
309 | |||
310 | |||
311 | /** |
||
312 | * return whether the price is a base price or not |
||
313 | * |
||
314 | * @return boolean |
||
315 | * @throws EE_Error |
||
316 | * @throws InvalidArgumentException |
||
317 | * @throws InvalidDataTypeException |
||
318 | * @throws InvalidInterfaceException |
||
319 | * @throws ReflectionException |
||
320 | */ |
||
321 | public function is_base_price() |
||
326 | |||
327 | |||
328 | /** |
||
329 | * @return EE_Base_Class|EE_Price_Type |
||
330 | * @throws EE_Error |
||
331 | * @throws InvalidArgumentException |
||
332 | * @throws ReflectionException |
||
333 | * @throws InvalidDataTypeException |
||
334 | * @throws InvalidInterfaceException |
||
335 | */ |
||
336 | public function type_obj() |
||
340 | |||
341 | |||
342 | /** |
||
343 | * @return int |
||
344 | * @throws EE_Error |
||
345 | * @throws InvalidArgumentException |
||
346 | * @throws ReflectionException |
||
347 | * @throws InvalidDataTypeException |
||
348 | * @throws InvalidInterfaceException |
||
349 | */ |
||
350 | public function type_order() |
||
354 | |||
355 | |||
356 | /** |
||
357 | * Simply indicates whether this price increases or decreases the total |
||
358 | * |
||
359 | * @return boolean true = discount, otherwise adds to the total |
||
360 | * @throws EE_Error |
||
361 | * @throws InvalidArgumentException |
||
362 | * @throws ReflectionException |
||
363 | * @throws InvalidDataTypeException |
||
364 | * @throws InvalidInterfaceException |
||
365 | */ |
||
366 | public function is_discount() |
||
371 | |||
372 | |||
373 | /** |
||
374 | * whether the price is a percentage or not |
||
375 | * |
||
376 | * @return boolean |
||
377 | * @throws EE_Error |
||
378 | * @throws InvalidArgumentException |
||
379 | * @throws InvalidDataTypeException |
||
380 | * @throws InvalidInterfaceException |
||
381 | * @throws ReflectionException |
||
382 | */ |
||
383 | public function is_percent() |
||
388 | |||
389 | |||
390 | /** |
||
391 | * whether the price is a percentage or not |
||
392 | * |
||
393 | * @return boolean |
||
394 | * @throws EE_Error |
||
395 | * @throws InvalidArgumentException |
||
396 | * @throws ReflectionException |
||
397 | * @throws InvalidDataTypeException |
||
398 | * @throws InvalidInterfaceException |
||
399 | */ |
||
400 | public function is_surcharge() |
||
405 | |||
406 | /** |
||
407 | * whether the price is a percentage or not |
||
408 | * |
||
409 | * @return boolean |
||
410 | * @throws EE_Error |
||
411 | * @throws InvalidArgumentException |
||
412 | * @throws ReflectionException |
||
413 | * @throws InvalidDataTypeException |
||
414 | * @throws InvalidInterfaceException |
||
415 | */ |
||
416 | public function is_tax() |
||
421 | |||
422 | |||
423 | /** |
||
424 | * return pretty price dependant on whether its a dollar or percent. |
||
425 | * |
||
426 | * @return string |
||
427 | * @throws EE_Error |
||
428 | * @throws InvalidArgumentException |
||
429 | * @throws ReflectionException |
||
430 | * @throws InvalidDataTypeException |
||
431 | * @throws InvalidInterfaceException |
||
432 | * @since 4.4.0 |
||
433 | */ |
||
434 | public function pretty_price() |
||
440 | |||
441 | |||
442 | /** |
||
443 | * @return mixed |
||
444 | * @throws EE_Error |
||
445 | * @throws InvalidArgumentException |
||
446 | * @throws ReflectionException |
||
447 | * @throws InvalidDataTypeException |
||
448 | * @throws InvalidInterfaceException |
||
449 | */ |
||
450 | public function get_price_without_currency_symbol() |
||
458 | } |
||
459 |