Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like EE_Registration often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use EE_Registration, and based on these observations, apply Extract Interface, too.
1 | <?php use EventEspresso\core\exceptions\EntityNotFoundException; |
||
13 | class EE_Registration extends EE_Soft_Delete_Base_Class implements EEI_Registration, EEI_Admin_Links { |
||
14 | |||
15 | |||
16 | /** |
||
17 | * Used to reference when a registration has never been checked in. |
||
18 | * @type int |
||
19 | */ |
||
20 | const checkin_status_never = 2; |
||
21 | |||
22 | /** |
||
23 | * Used to reference when a registration has been checked in. |
||
24 | * @type int |
||
25 | */ |
||
26 | const checkin_status_in = 1; |
||
27 | |||
28 | |||
29 | /** |
||
30 | * Used to reference when a registration has been checked out. |
||
31 | * @type int |
||
32 | */ |
||
33 | const checkin_status_out = 0; |
||
34 | |||
35 | |||
36 | |||
37 | /** |
||
38 | * |
||
39 | * @param array $props_n_values incoming values |
||
40 | * @param string $timezone incoming timezone (if not set the timezone set for the website will be |
||
41 | * used.) |
||
42 | * @param array $date_formats incoming date_formats in an array where the first value is the |
||
43 | * date_format and the second value is the time format |
||
44 | * @return EE_Registration |
||
45 | */ |
||
46 | public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
||
50 | |||
51 | |||
52 | |||
53 | /** |
||
54 | * @param array $props_n_values incoming values from the database |
||
55 | * @param string $timezone incoming timezone as set by the model. If not set the timezone for |
||
56 | * the website will be used. |
||
57 | * @return EE_Registration |
||
58 | */ |
||
59 | public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
||
62 | |||
63 | |||
64 | |||
65 | /** |
||
66 | * Set Event ID |
||
67 | * |
||
68 | * @access public |
||
69 | * @param int $EVT_ID Event ID |
||
70 | */ |
||
71 | public function set_event( $EVT_ID = 0 ) { |
||
74 | |||
75 | |||
76 | |||
77 | /** |
||
78 | * Overrides parent set() method so that all calls to set( 'REG_code', $REG_code ) OR set( 'STS_ID', $STS_ID ) can be routed to internal methods |
||
79 | * @param string $field_name |
||
80 | * @param mixed $field_value |
||
81 | * @param bool $use_default |
||
82 | */ |
||
83 | public function set( $field_name, $field_value, $use_default = FALSE ) { |
||
97 | |||
98 | |||
99 | |||
100 | /** |
||
101 | * Set Status ID |
||
102 | * updates the registration status and ALSO... |
||
103 | * calls reserve_registration_space() if the reg status changes TO approved from any other reg status |
||
104 | * calls release_registration_space() if the reg status changes FROM approved to any other reg status |
||
105 | * |
||
106 | * @access public |
||
107 | * @param string $new_STS_ID |
||
108 | * @param boolean $use_default |
||
109 | * @return bool |
||
110 | * @throws \EE_Error |
||
111 | */ |
||
112 | public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) { |
||
181 | |||
182 | |||
183 | |||
184 | /** |
||
185 | * get Status ID |
||
186 | * @access public |
||
187 | */ |
||
188 | public function status_ID() { |
||
191 | |||
192 | |||
193 | |||
194 | /** |
||
195 | * increments this registration's related ticket sold and corresponding datetime sold values |
||
196 | * @return void |
||
197 | */ |
||
198 | private function _reserve_registration_space() { |
||
205 | |||
206 | |||
207 | |||
208 | /** |
||
209 | * Gets the ticket this registration is for |
||
210 | * |
||
211 | * @param boolean $include_archived whether to include archived tickets or not. |
||
212 | * @return EE_Ticket |
||
213 | */ |
||
214 | public function ticket( $include_archived = TRUE ) { |
||
221 | |||
222 | |||
223 | |||
224 | /** |
||
225 | * Gets the event this registration is for |
||
226 | * @return EE_Event |
||
227 | */ |
||
228 | public function event() { |
||
235 | |||
236 | |||
237 | |||
238 | /** |
||
239 | * Gets the "author" of the registration. Note that for the purposes of registrations, the author will correspond with the author of the event this registration is for. |
||
240 | * |
||
241 | * @since 4.5.0 |
||
242 | * |
||
243 | * @return int |
||
244 | */ |
||
245 | public function wp_user() { |
||
246 | $event = $this->event(); |
||
247 | if ( $event instanceof EE_Event ) { |
||
248 | return $event->wp_user(); |
||
249 | } |
||
250 | return 0; |
||
251 | } |
||
252 | |||
253 | |||
254 | |||
255 | /** |
||
256 | * decrements (subtracts) this registration's related ticket sold and corresponding datetime sold values |
||
257 | * @return void |
||
258 | */ |
||
259 | private function _release_registration_space() { |
||
264 | |||
265 | |||
266 | |||
267 | /** |
||
268 | * Set Attendee ID |
||
269 | * |
||
270 | * @access public |
||
271 | * @param int $ATT_ID Attendee ID |
||
272 | */ |
||
273 | public function set_attendee_id( $ATT_ID = 0 ) { |
||
276 | |||
277 | |||
278 | |||
279 | /** |
||
280 | * Set Transaction ID |
||
281 | * |
||
282 | * @access public |
||
283 | * @param int $TXN_ID Transaction ID |
||
284 | */ |
||
285 | public function set_transaction_id( $TXN_ID = 0 ) { |
||
288 | |||
289 | |||
290 | |||
291 | /** |
||
292 | * Set Session |
||
293 | * |
||
294 | * @access public |
||
295 | * @param string $REG_session PHP Session ID |
||
296 | */ |
||
297 | public function set_session( $REG_session = '' ) { |
||
300 | |||
301 | |||
302 | |||
303 | /** |
||
304 | * Set Registration URL Link |
||
305 | * |
||
306 | * @access public |
||
307 | * @param string $REG_url_link Registration URL Link |
||
308 | */ |
||
309 | public function set_reg_url_link( $REG_url_link = '' ) { |
||
312 | |||
313 | |||
314 | |||
315 | /** |
||
316 | * Set Attendee Counter |
||
317 | * |
||
318 | * @access public |
||
319 | * @param int $REG_count Primary Attendee |
||
320 | */ |
||
321 | public function set_count( $REG_count = 1 ) { |
||
324 | |||
325 | |||
326 | |||
327 | /** |
||
328 | * Set Group Size |
||
329 | * |
||
330 | * @access public |
||
331 | * @param boolean $REG_group_size Group Registration |
||
332 | */ |
||
333 | public function set_group_size( $REG_group_size = FALSE ) { |
||
336 | |||
337 | |||
338 | |||
339 | /** |
||
340 | * is_not_approved - convenience method that returns TRUE if REG status ID == EEM_Registration::status_id_not_approved |
||
341 | * |
||
342 | * @access public |
||
343 | * @return boolean |
||
344 | */ |
||
345 | public function is_not_approved() { |
||
348 | |||
349 | |||
350 | |||
351 | /** |
||
352 | * is_pending_payment - convenience method that returns TRUE if REG status ID == EEM_Registration::status_id_pending_payment |
||
353 | * |
||
354 | * @access public |
||
355 | * @return boolean |
||
356 | */ |
||
357 | public function is_pending_payment() { |
||
360 | |||
361 | |||
362 | |||
363 | /** |
||
364 | * is_approved - convenience method that returns TRUE if REG status ID == EEM_Registration::status_id_approved |
||
365 | * |
||
366 | * @access public |
||
367 | * @return boolean |
||
368 | */ |
||
369 | public function is_approved() { |
||
372 | |||
373 | |||
374 | |||
375 | /** |
||
376 | * is_cancelled - convenience method that returns TRUE if REG status ID == EEM_Registration::status_id_cancelled |
||
377 | * |
||
378 | * @access public |
||
379 | * @return boolean |
||
380 | */ |
||
381 | public function is_cancelled() { |
||
384 | |||
385 | |||
386 | |||
387 | /** |
||
388 | * is_declined - convenience method that returns TRUE if REG status ID == EEM_Registration::status_id_declined |
||
389 | * |
||
390 | * @access public |
||
391 | * @return boolean |
||
392 | */ |
||
393 | public function is_declined() { |
||
396 | |||
397 | |||
398 | |||
399 | /** |
||
400 | * is_incomplete - convenience method that returns TRUE if REG status ID == EEM_Registration::status_id_incomplete |
||
401 | * |
||
402 | * @access public |
||
403 | * @return boolean |
||
404 | */ |
||
405 | public function is_incomplete() { |
||
408 | |||
409 | |||
410 | |||
411 | /** |
||
412 | * Set Registration Date |
||
413 | * |
||
414 | * @access public |
||
415 | * @param mixed ( int or string ) $REG_date Registration Date - Unix timestamp or string representation of Date |
||
416 | */ |
||
417 | public function set_reg_date( $REG_date = FALSE ) { |
||
420 | |||
421 | |||
422 | |||
423 | /** |
||
424 | * Set final price owing for this registration after all ticket/price modifications |
||
425 | * |
||
426 | * @access public |
||
427 | * @param float $REG_final_price |
||
428 | */ |
||
429 | public function set_final_price( $REG_final_price = 0.00 ) { |
||
432 | |||
433 | |||
434 | |||
435 | /** |
||
436 | * Set amount paid towards this registration's final price |
||
437 | * |
||
438 | * @access public |
||
439 | * @param float $REG_paid |
||
440 | */ |
||
441 | public function set_paid( $REG_paid = 0.00 ) { |
||
444 | |||
445 | |||
446 | |||
447 | /** |
||
448 | * Attendee Is Going |
||
449 | * |
||
450 | * @access public |
||
451 | * @param boolean $REG_att_is_going Attendee Is Going |
||
452 | */ |
||
453 | public function set_att_is_going( $REG_att_is_going = FALSE ) { |
||
456 | |||
457 | |||
458 | |||
459 | /** |
||
460 | * Gets the related attendee |
||
461 | * @return EE_Attendee |
||
462 | */ |
||
463 | public function attendee() { |
||
466 | |||
467 | |||
468 | |||
469 | /** |
||
470 | * get Event ID |
||
471 | * @access public |
||
472 | */ |
||
473 | public function event_ID() { |
||
476 | |||
477 | |||
478 | |||
479 | /** |
||
480 | * get Event ID |
||
481 | * @access public |
||
482 | */ |
||
483 | public function event_name() { |
||
491 | |||
492 | |||
493 | |||
494 | /** |
||
495 | * Fetches the event this registration is for |
||
496 | * @return EE_Event |
||
497 | */ |
||
498 | public function event_obj() { |
||
501 | |||
502 | |||
503 | |||
504 | /** |
||
505 | * get Attendee ID |
||
506 | * @access public |
||
507 | */ |
||
508 | public function attendee_ID() { |
||
511 | |||
512 | |||
513 | |||
514 | /** |
||
515 | * get PHP Session ID |
||
516 | * @access public |
||
517 | */ |
||
518 | public function session_ID() { |
||
521 | |||
522 | |||
523 | |||
524 | /** |
||
525 | * Gets the string which represents the URL trigger for the receipt template in the message template system. |
||
526 | * @param string $messenger 'pdf' or 'html'. Default 'html'. |
||
527 | * @return string |
||
528 | */ |
||
529 | public function receipt_url( $messenger = 'html' ) { |
||
544 | |||
545 | |||
546 | |||
547 | |||
548 | /** |
||
549 | * Gets the string which represents the URL trigger for the invoice template in the message template system. |
||
550 | * @param string $messenger 'pdf' or 'html'. Default 'html'. |
||
551 | * @return string |
||
552 | */ |
||
553 | public function invoice_url( $messenger = 'html' ) { |
||
576 | |||
577 | |||
578 | |||
579 | /** |
||
580 | * get Registration URL Link |
||
581 | * |
||
582 | * @access public |
||
583 | * @return string |
||
584 | * @throws \EE_Error |
||
585 | */ |
||
586 | public function reg_url_link() { |
||
589 | |||
590 | |||
591 | |||
592 | /** |
||
593 | * Echoes out invoice_url() |
||
594 | * @param string $type 'download','launch', or 'html' (default is 'launch') |
||
595 | * @return void |
||
596 | */ |
||
597 | public function e_invoice_url( $type = 'launch' ) { |
||
600 | |||
601 | |||
602 | |||
603 | /** |
||
604 | * Echoes out payment_overview_url |
||
605 | */ |
||
606 | public function e_payment_overview_url() { |
||
609 | |||
610 | |||
611 | |||
612 | /** |
||
613 | * Gets the URL of the thank you page with this registration REG_url_link added as |
||
614 | * a query parameter |
||
615 | * @return string |
||
616 | */ |
||
617 | public function payment_overview_url() { |
||
620 | |||
621 | |||
622 | |||
623 | /** |
||
624 | * Gets the URL of the thank you page with this registration REG_url_link added as |
||
625 | * a query parameter |
||
626 | * @return string |
||
627 | */ |
||
628 | public function edit_attendee_information_url() { |
||
631 | |||
632 | |||
633 | |||
634 | /** |
||
635 | * Simply generates and returns the appropriate admin_url link to edit this registration |
||
636 | * @return string |
||
637 | */ |
||
638 | public function get_admin_edit_url() { |
||
641 | |||
642 | |||
643 | |||
644 | /** |
||
645 | * is_primary_registrant? |
||
646 | * @access public |
||
647 | */ |
||
648 | public function is_primary_registrant() { |
||
651 | |||
652 | |||
653 | |||
654 | /** |
||
655 | * This returns the primary registration object for this registration group (which may be this object). |
||
656 | * @return EE_Registration |
||
657 | */ |
||
658 | public function get_primary_registration() { |
||
666 | |||
667 | |||
668 | |||
669 | /** |
||
670 | * get Attendee Number |
||
671 | * @access public |
||
672 | */ |
||
673 | public function count() { |
||
676 | |||
677 | |||
678 | |||
679 | /** |
||
680 | * get Group Size |
||
681 | * @access public |
||
682 | */ |
||
683 | public function group_size() { |
||
686 | |||
687 | |||
688 | |||
689 | /** |
||
690 | * get Registration Date |
||
691 | * @access public |
||
692 | */ |
||
693 | public function date() { |
||
696 | |||
697 | |||
698 | |||
699 | /** |
||
700 | * gets a pretty date |
||
701 | * @param string $date_format |
||
702 | * @param string $time_format |
||
703 | * @return string |
||
704 | */ |
||
705 | public function pretty_date( $date_format = NULL, $time_format = NULL ) { |
||
708 | |||
709 | |||
710 | |||
711 | /** |
||
712 | * final_price |
||
713 | * the registration's share of the transaction total, so that the |
||
714 | * sum of all the transaction's REG_final_prices equal the transaction's total |
||
715 | * @access public |
||
716 | * @return float |
||
717 | */ |
||
718 | public function final_price() { |
||
721 | |||
722 | |||
723 | |||
724 | /** |
||
725 | * pretty_final_price |
||
726 | * final price as formatted string, with correct decimal places and currency symbol |
||
727 | * @return string |
||
728 | */ |
||
729 | public function pretty_final_price() { |
||
732 | |||
733 | |||
734 | |||
735 | /** |
||
736 | * get paid (yeah) |
||
737 | * @access public |
||
738 | * @return float |
||
739 | */ |
||
740 | public function paid() { |
||
743 | |||
744 | |||
745 | |||
746 | /** |
||
747 | * pretty_paid |
||
748 | * @access public |
||
749 | * @return float |
||
750 | */ |
||
751 | public function pretty_paid() { |
||
754 | |||
755 | |||
756 | |||
757 | /** |
||
758 | * owes_monies_and_can_pay |
||
759 | * whether or not this registration has monies owing and it's' status allows payment |
||
760 | * @access public |
||
761 | * @param array $requires_payment |
||
762 | * @return bool |
||
763 | */ |
||
764 | public function owes_monies_and_can_pay( $requires_payment = array()) { |
||
777 | |||
778 | |||
779 | |||
780 | /** |
||
781 | * Prints out the return value of $this->pretty_status() |
||
782 | * @param bool $show_icons |
||
783 | * @return void |
||
784 | */ |
||
785 | public function e_pretty_status( $show_icons = FALSE ) { |
||
788 | |||
789 | |||
790 | |||
791 | |||
792 | /** |
||
793 | * Returns a nice version of the status for displaying to customers |
||
794 | * @param bool $show_icons |
||
795 | * @return string |
||
796 | */ |
||
797 | public function pretty_status( $show_icons = FALSE ) { |
||
825 | |||
826 | |||
827 | |||
828 | /** |
||
829 | * get Attendee Is Going |
||
830 | * @access public |
||
831 | */ |
||
832 | public function att_is_going() { |
||
835 | |||
836 | |||
837 | |||
838 | /** |
||
839 | * Gets related answers |
||
840 | * @param array $query_params like EEM_Base::get_all |
||
841 | * @return EE_Answer[] |
||
842 | */ |
||
843 | public function answers( $query_params = NULL ) { |
||
846 | |||
847 | |||
848 | |||
849 | /** |
||
850 | * Gets the registration's answer value to the specified question |
||
851 | * (either the question's ID or a question object) |
||
852 | * @param EE_Question|int $question |
||
853 | * @param bool $pretty_value |
||
854 | * @return array|string if pretty_value= true, the result will always be a string |
||
855 | * (because the answer might be an array of answer values, so passing pretty_value=true |
||
856 | * will convert it into some kind of string) |
||
857 | */ |
||
858 | public function answer_value_to_question( $question, $pretty_value=true ) { |
||
862 | |||
863 | |||
864 | |||
865 | /** |
||
866 | * question_groups |
||
867 | * returns an array of EE_Question_Group objects for this registration |
||
868 | * |
||
869 | * @return EE_Question_Group[] |
||
870 | */ |
||
871 | public function question_groups() { |
||
885 | |||
886 | |||
887 | |||
888 | /** |
||
889 | * count_question_groups |
||
890 | * returns a count of the number of EE_Question_Group objects for this registration |
||
891 | * |
||
892 | * @return int |
||
893 | */ |
||
894 | public function count_question_groups() { |
||
908 | |||
909 | |||
910 | |||
911 | /** |
||
912 | * Returns the registration date in the 'standard' string format |
||
913 | * (function may be improved in the future to allow for different formats and timezones) |
||
914 | * @return string |
||
915 | */ |
||
916 | public function reg_date() { |
||
919 | |||
920 | |||
921 | |||
922 | /** |
||
923 | * Gets the datetime-ticket for this registration (ie, it can be used to isolate |
||
924 | * the ticket this registration purchased, or the datetime they have registered |
||
925 | * to attend) |
||
926 | * @return EE_Datetime_Ticket |
||
927 | */ |
||
928 | public function datetime_ticket() { |
||
931 | |||
932 | |||
933 | |||
934 | /** |
||
935 | * Sets the registration's datetime_ticket. |
||
936 | * @param EE_Datetime_Ticket $datetime_ticket |
||
937 | * @return EE_Datetime_Ticket |
||
938 | */ |
||
939 | public function set_datetime_ticket( $datetime_ticket ) { |
||
942 | /** |
||
943 | * Gets deleted |
||
944 | * @return boolean |
||
945 | */ |
||
946 | public function deleted() { |
||
949 | |||
950 | /** |
||
951 | * Sets deleted |
||
952 | * @param boolean $deleted |
||
953 | * @return boolean |
||
954 | */ |
||
955 | public function set_deleted($deleted) { |
||
958 | |||
959 | |||
960 | |||
961 | /** |
||
962 | * Get the status object of this object |
||
963 | * @return EE_Status |
||
964 | */ |
||
965 | public function status_obj() { |
||
968 | |||
969 | |||
970 | |||
971 | /** |
||
972 | * Returns the number of times this registration has checked into any of the datetimes |
||
973 | * its available for |
||
974 | * @return int |
||
975 | */ |
||
976 | public function count_checkins() { |
||
979 | |||
980 | |||
981 | |||
982 | /** |
||
983 | * Returns the number of current Check-ins this registration is checked into for any of the datetimes the registration is for. Note, this is ONLY checked in (does not include checkedout) |
||
984 | * @return int |
||
985 | */ |
||
986 | public function count_checkins_not_checkedout() { |
||
989 | |||
990 | |||
991 | |||
992 | /** |
||
993 | * The purpose of this method is simply to check whether this registration can checkin to the given datetime. |
||
994 | * |
||
995 | * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against |
||
996 | * @param bool $check_approved This is used to indicate whether the caller wants can_checkin to also consider registration status as well as datetime access. |
||
997 | * |
||
998 | * @return bool |
||
999 | */ |
||
1000 | public function can_checkin( $DTT_OR_ID, $check_approved = TRUE ) { |
||
1015 | |||
1016 | |||
1017 | /** |
||
1018 | * This method verifies whether the user can checkin for the given datetime considering the max uses value set on the ticket. |
||
1019 | * |
||
1020 | * To do this, a query is done to get the count of the datetime records already checked into. If the datetime given does |
||
1021 | * not have a check-in record and checking in for that datetime will exceed the allowed uses, then return false. Otherwise return true. |
||
1022 | * |
||
1023 | * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against |
||
1024 | * @return bool true means can checkin. false means cannot checkin. |
||
1025 | */ |
||
1026 | public function verify_can_checkin_against_TKT_uses( $DTT_OR_ID ) { |
||
1058 | |||
1059 | |||
1060 | |||
1061 | /** |
||
1062 | * toggle Check-in status for this registration |
||
1063 | * |
||
1064 | * Check-ins are toggled in the following order: |
||
1065 | * never checked in -> checked in |
||
1066 | * checked in -> checked out |
||
1067 | * checked out -> checked in |
||
1068 | * |
||
1069 | * |
||
1070 | * @param int $DTT_ID include specific datetime to toggle Check-in for. If not included or null, then it is assumed primary datetime is being toggled. |
||
1071 | * @param bool $verify If true then can_checkin() is used to verify whether the person can be checked in or not. Otherwise this forces change in checkin status. |
||
1072 | * @return int|BOOL the chk_in status toggled to OR false if nothing got changed. |
||
1073 | */ |
||
1074 | public function toggle_checkin_status( $DTT_ID = null, $verify = false ) { |
||
1127 | |||
1128 | |||
1129 | |||
1130 | /** |
||
1131 | * Gets the primary datetime related to this registration via the related Event to this registration |
||
1132 | * @return EE_Datetime |
||
1133 | */ |
||
1134 | public function get_related_primary_datetime() { |
||
1137 | |||
1138 | |||
1139 | |||
1140 | /** |
||
1141 | * This method simply returns the check-in status for this registration and the given datetime. |
||
1142 | * @param int $DTT_ID The ID of the datetime we're checking against (if empty we'll get the primary datetime for this registration (via event) and use it's ID); |
||
1143 | * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id. |
||
1144 | * @return int Integer representing Check-in status. |
||
1145 | */ |
||
1146 | public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = NULL ) { |
||
1167 | |||
1168 | |||
1169 | |||
1170 | /** |
||
1171 | * This method returns a localized message for the toggled Check-in message. |
||
1172 | * @param int $DTT_ID include specific datetime to get the correct Check-in message. If not included or null, then it is assumed Check-in for primary datetime was toggled. |
||
1173 | * @param bool $error This just flags that you want an error message returned. This is put in so that the error message can be customized with the attendee name. |
||
1174 | * @return string internationalized message |
||
1175 | */ |
||
1176 | public function get_checkin_msg( $DTT_ID, $error = FALSE ) { |
||
1199 | |||
1200 | |||
1201 | |||
1202 | /** |
||
1203 | * Returns the related EE_Transaction to this registration |
||
1204 | * @return EE_Transaction |
||
1205 | */ |
||
1206 | public function transaction() { |
||
1213 | |||
1214 | |||
1215 | |||
1216 | |||
1217 | /** |
||
1218 | * get Registration Code |
||
1219 | * @access public |
||
1220 | */ |
||
1221 | public function reg_code() { |
||
1224 | |||
1225 | |||
1226 | |||
1227 | /** |
||
1228 | * get Transaction ID |
||
1229 | * @access public |
||
1230 | */ |
||
1231 | public function transaction_ID() { |
||
1234 | |||
1235 | |||
1236 | |||
1237 | /** |
||
1238 | * @return int |
||
1239 | */ |
||
1240 | public function ticket_ID() { |
||
1243 | |||
1244 | |||
1245 | |||
1246 | /** |
||
1247 | * Set Registration Code |
||
1248 | * |
||
1249 | * @access public |
||
1250 | * @param string $REG_code Registration Code |
||
1251 | * @param boolean $use_default |
||
1252 | */ |
||
1253 | public function set_reg_code( $REG_code, $use_default = FALSE ) { |
||
1268 | |||
1269 | |||
1270 | |||
1271 | |||
1272 | /** |
||
1273 | * Returns all other registrations in the same group as this registrant who have the same ticket option. |
||
1274 | * |
||
1275 | * Note, if you want to just get all registrations in the same transaction (group), use: |
||
1276 | * $registration->transaction()->registrations(); |
||
1277 | * |
||
1278 | * @since 4.5.0 |
||
1279 | * |
||
1280 | * @return EE_Registration[] or empty array if this isn't a group registration. |
||
1281 | */ |
||
1282 | public function get_all_other_registrations_in_group() { |
||
1296 | |||
1297 | /** |
||
1298 | * Return the link to the admin details for the object. |
||
1299 | * @return string |
||
1300 | */ |
||
1301 | View Code Duplication | public function get_admin_details_link() { |
|
1312 | |||
1313 | /** |
||
1314 | * Returns the link to the editor for the object. Sometimes this is the same as the details. |
||
1315 | * @return string |
||
1316 | */ |
||
1317 | public function get_admin_edit_link() { |
||
1320 | |||
1321 | /** |
||
1322 | * Returns the link to a settings page for the object. |
||
1323 | * @return string |
||
1324 | */ |
||
1325 | public function get_admin_settings_link() { |
||
1328 | |||
1329 | /** |
||
1330 | * Returns the link to the "overview" for the object (typically the "list table" view). |
||
1331 | * @return string |
||
1332 | */ |
||
1333 | public function get_admin_overview_link() { |
||
1342 | |||
1343 | |||
1344 | |||
1345 | /** |
||
1346 | * @param array $query_params |
||
1347 | * @return \EE_Registration[] |
||
1348 | * @throws \EE_Error |
||
1349 | */ |
||
1350 | public function payments( $query_params = array() ) { |
||
1353 | |||
1354 | |||
1355 | |||
1356 | /** |
||
1357 | * @param array $query_params |
||
1358 | * @return \EE_Registration_Payment[] |
||
1359 | * @throws \EE_Error |
||
1360 | */ |
||
1361 | public function registration_payments( $query_params = array() ) { |
||
1364 | |||
1365 | |||
1366 | |||
1367 | |||
1368 | /** |
||
1369 | * This grabs the payment method corresponding to the last payment made for the amount owing on the registration. |
||
1370 | * Note: if there are no payments on the registration there will be no payment method returned. |
||
1371 | * |
||
1372 | * @return EE_Payment_Method|null |
||
1373 | */ |
||
1374 | public function payment_method() { |
||
1377 | |||
1378 | |||
1379 | |||
1380 | /** |
||
1381 | * @return \EE_Line_Item |
||
1382 | * @throws EntityNotFoundException |
||
1383 | * @throws \EE_Error |
||
1384 | */ |
||
1385 | public function ticket_line_item() |
||
1410 | |||
1411 | |||
1412 | |||
1413 | /** |
||
1414 | * @deprecated |
||
1415 | * @since 4.7.0 |
||
1416 | * @access public |
||
1417 | */ |
||
1418 | public function price_paid() |
||
1425 | |||
1426 | |||
1427 | |||
1428 | /** |
||
1429 | * @deprecated |
||
1430 | * @since 4.7.0 |
||
1431 | * @access public |
||
1432 | * @param float $REG_final_price |
||
1433 | */ |
||
1434 | public function set_price_paid($REG_final_price = 0.00) |
||
1441 | |||
1442 | |||
1443 | |||
1444 | /** |
||
1445 | * @deprecated |
||
1446 | * @since 4.7.0 |
||
1447 | * @return string |
||
1448 | */ |
||
1449 | public function pretty_price_paid() |
||
1456 | |||
1457 | |||
1458 | } |
||
1459 | /* End of file EE_Registration.class.php */ |
||
1461 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.