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_Checkout 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_Checkout, and based on these observations, apply Extract Interface, too.
| 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
||
| 14 | class EE_Checkout { |
||
| 15 | |||
| 16 | /** |
||
| 17 | * whether current request originated from the EE admin |
||
| 18 | * @type bool |
||
| 19 | */ |
||
| 20 | public $admin_request = FALSE; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * whether returning to edit attendee information or to retry a payment |
||
| 24 | * @type bool |
||
| 25 | */ |
||
| 26 | public $revisit = FALSE; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * whether the primary registrant is returning to edit attendee information or to retry a payment |
||
| 30 | * @type bool |
||
| 31 | */ |
||
| 32 | public $primary_revisit = FALSE; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * is registration allowed to progress or halted for some reason such as failing to pass recaptcha? |
||
| 36 | * @type bool |
||
| 37 | */ |
||
| 38 | public $continue_reg = TRUE; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * redirect to thank you page ? |
||
| 42 | * @type bool |
||
| 43 | */ |
||
| 44 | public $redirect = FALSE; |
||
| 45 | |||
| 46 | /** |
||
| 47 | * generate the reg form or not ? |
||
| 48 | * @type bool |
||
| 49 | */ |
||
| 50 | public $generate_reg_form = TRUE; |
||
| 51 | |||
| 52 | /** |
||
| 53 | * process a reg form submission or not ? |
||
| 54 | * @type bool |
||
| 55 | */ |
||
| 56 | public $process_form_submission = FALSE; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * tracks whether the TXN status modified during this checkout |
||
| 60 | * |
||
| 61 | * @type bool |
||
| 62 | */ |
||
| 63 | public $txn_status_updated = FALSE; |
||
| 64 | |||
| 65 | /** |
||
| 66 | * only triggered to true after absolutely everything has finished. |
||
| 67 | * |
||
| 68 | * @type bool |
||
| 69 | */ |
||
| 70 | protected $exit_spco = FALSE; |
||
| 71 | |||
| 72 | /** |
||
| 73 | * tracks whether any of the TXN's Registrations statuses modified during this checkout |
||
| 74 | * indexed by registration ID |
||
| 75 | * |
||
| 76 | * @type array |
||
| 77 | */ |
||
| 78 | protected $reg_status_updated = array(); |
||
| 79 | |||
| 80 | /** |
||
| 81 | * total number of tickets that were in the cart |
||
| 82 | * @type int |
||
| 83 | */ |
||
| 84 | public $total_ticket_count = 0; |
||
| 85 | |||
| 86 | /** |
||
| 87 | * corresponds loosely to EE_Transaction::remaining() |
||
| 88 | * but can be modified by SPCO |
||
| 89 | * |
||
| 90 | * @type float |
||
| 91 | */ |
||
| 92 | public $amount_owing = 0; |
||
| 93 | |||
| 94 | /** |
||
| 95 | * the reg step slug from the incoming request |
||
| 96 | * @type string |
||
| 97 | */ |
||
| 98 | public $step = ''; |
||
| 99 | |||
| 100 | /** |
||
| 101 | * the reg step slug for a step being edited |
||
| 102 | * @type string |
||
| 103 | */ |
||
| 104 | public $edit_step = ''; |
||
| 105 | |||
| 106 | /** |
||
| 107 | * the action being performed on the current step |
||
| 108 | * @type string |
||
| 109 | */ |
||
| 110 | public $action = ''; |
||
| 111 | |||
| 112 | /** |
||
| 113 | * reg_url_link for a previously saved registration |
||
| 114 | * @type string |
||
| 115 | */ |
||
| 116 | public $reg_url_link = ''; |
||
| 117 | |||
| 118 | /** |
||
| 119 | * string slug for the payment method that was selected during the payment options step |
||
| 120 | * @type string |
||
| 121 | */ |
||
| 122 | public $selected_method_of_payment = ''; |
||
| 123 | |||
| 124 | /** |
||
| 125 | * base url for the site's registration checkout page - additional url params will be added to this |
||
| 126 | * @type string |
||
| 127 | */ |
||
| 128 | public $reg_page_base_url = ''; |
||
| 129 | |||
| 130 | /** |
||
| 131 | * base url for the site's registration cancelled page - additional url params will be added to this |
||
| 132 | * @type string |
||
| 133 | */ |
||
| 134 | public $cancel_page_url = ''; |
||
| 135 | |||
| 136 | /** |
||
| 137 | * base url for the site's thank you page - additional url params will be added to this |
||
| 138 | * @type string |
||
| 139 | */ |
||
| 140 | public $thank_you_page_url = ''; |
||
| 141 | |||
| 142 | /** |
||
| 143 | * base url for any redirects - additional url params will be added to this |
||
| 144 | * @type string |
||
| 145 | */ |
||
| 146 | public $redirect_url = ''; |
||
| 147 | |||
| 148 | /** |
||
| 149 | * form of POST data for use with off-site gateways |
||
| 150 | * @type string |
||
| 151 | */ |
||
| 152 | public $redirect_form = ''; |
||
| 153 | |||
| 154 | /** |
||
| 155 | * array of query where params to use when retrieving cached registrations from $this->checkout->transaction |
||
| 156 | * @type array |
||
| 157 | */ |
||
| 158 | public $reg_cache_where_params = array(); |
||
| 159 | |||
| 160 | /** |
||
| 161 | * a class for managing and creating the JSON encoded array of data that gets passed back to the client during AJAX requests |
||
| 162 | * @type EE_SPCO_JSON_Response |
||
| 163 | */ |
||
| 164 | public $json_response = NULL; |
||
| 165 | |||
| 166 | /** |
||
| 167 | * where we are going next in the reg process |
||
| 168 | * @type EE_SPCO_Reg_Step |
||
| 169 | */ |
||
| 170 | public $next_step = NULL; |
||
| 171 | |||
| 172 | /** |
||
| 173 | * where we are in the reg process |
||
| 174 | * @type EE_SPCO_Reg_Step |
||
| 175 | */ |
||
| 176 | public $current_step = NULL; |
||
| 177 | |||
| 178 | /** |
||
| 179 | * $_cart - the current cart object |
||
| 180 | * @var EE_CART |
||
| 181 | */ |
||
| 182 | public $cart = NULL; |
||
| 183 | |||
| 184 | /** |
||
| 185 | * $_transaction - the current transaction object |
||
| 186 | * @var EE_Transaction |
||
| 187 | */ |
||
| 188 | public $transaction = NULL; |
||
| 189 | |||
| 190 | /** |
||
| 191 | * the related attendee object for the primary registrant |
||
| 192 | * @type EE_Attendee |
||
| 193 | */ |
||
| 194 | public $primary_attendee_obj = NULL; |
||
| 195 | |||
| 196 | /** |
||
| 197 | * $payment_method - the payment method object for the selected method of payment |
||
| 198 | * @type EE_Payment_Method |
||
| 199 | */ |
||
| 200 | public $payment_method = NULL; |
||
| 201 | |||
| 202 | /** |
||
| 203 | * $payment - if a payment was successfully made during the reg process, |
||
| 204 | * then here it is !!! |
||
| 205 | * @type EE_Payment |
||
| 206 | */ |
||
| 207 | public $payment = NULL; |
||
| 208 | |||
| 209 | /** |
||
| 210 | * if a payment method was selected that uses an on-site gateway, then this is the billing form |
||
| 211 | * @type EE_Billing_Info_Form | EE_Billing_Attendee_Info_Form |
||
| 212 | */ |
||
| 213 | public $billing_form = NULL; |
||
| 214 | |||
| 215 | /** |
||
| 216 | * the entire registration form composed of ALL of the subsections generated by the various reg steps |
||
| 217 | * @type EE_Form_Section_Proper |
||
| 218 | */ |
||
| 219 | public $registration_form = NULL; |
||
| 220 | |||
| 221 | /** |
||
| 222 | * array of EE_SPCO_Reg_Step objects |
||
| 223 | * @type EE_SPCO_Reg_Step[] |
||
| 224 | */ |
||
| 225 | public $reg_steps = array(); |
||
| 226 | |||
| 227 | /** |
||
| 228 | * array of EE_Payment_Method objects |
||
| 229 | * @type EE_Payment_Method[] |
||
| 230 | */ |
||
| 231 | public $available_payment_methods = array(); |
||
| 232 | |||
| 233 | |||
| 234 | |||
| 235 | /** |
||
| 236 | * class constructor |
||
| 237 | * |
||
| 238 | * @access public |
||
| 239 | * @return \EE_Checkout |
||
|
|
|||
| 240 | */ |
||
| 241 | public function __construct( ) { |
||
| 249 | |||
| 250 | |||
| 251 | |||
| 252 | /** |
||
| 253 | * returns true if ANY reg status was updated during checkout |
||
| 254 | * @return array |
||
| 255 | */ |
||
| 256 | public function any_reg_status_updated() { |
||
| 257 | foreach ( $this->reg_status_updated as $reg_status ) { |
||
| 258 | if ( $reg_status ) { |
||
| 259 | return true; |
||
| 260 | } |
||
| 261 | } |
||
| 262 | return false; |
||
| 263 | } |
||
| 264 | |||
| 265 | |||
| 266 | |||
| 267 | /** |
||
| 268 | * @param $REG_ID |
||
| 269 | * @return array |
||
| 270 | */ |
||
| 271 | public function reg_status_updated( $REG_ID ) { |
||
| 274 | |||
| 275 | |||
| 276 | |||
| 277 | /** |
||
| 278 | * @param $REG_ID |
||
| 279 | * @param $reg_status |
||
| 280 | */ |
||
| 281 | public function set_reg_status_updated( $REG_ID, $reg_status ) { |
||
| 284 | |||
| 285 | |||
| 286 | |||
| 287 | /** |
||
| 288 | * exit_spco |
||
| 289 | * |
||
| 290 | * @return bool |
||
| 291 | */ |
||
| 292 | public function exit_spco() { |
||
| 295 | |||
| 296 | |||
| 297 | |||
| 298 | /** |
||
| 299 | * set_exit_spco |
||
| 300 | * can ONLY be set by the Finalize_Registration reg step |
||
| 301 | */ |
||
| 302 | public function set_exit_spco() { |
||
| 307 | |||
| 308 | |||
| 309 | |||
| 310 | |||
| 311 | |||
| 312 | /** |
||
| 313 | * reset_for_current_request |
||
| 314 | * |
||
| 315 | * @access public |
||
| 316 | * @return void |
||
| 317 | */ |
||
| 318 | public function reset_for_current_request() { |
||
| 332 | |||
| 333 | |||
| 334 | |||
| 335 | /** |
||
| 336 | * add_reg_step |
||
| 337 | * |
||
| 338 | * @access public |
||
| 339 | * @param EE_SPCO_Reg_Step $reg_step_obj |
||
| 340 | * @return void |
||
| 341 | */ |
||
| 342 | public function add_reg_step( EE_SPCO_Reg_Step $reg_step_obj ) { |
||
| 345 | |||
| 346 | |||
| 347 | |||
| 348 | /** |
||
| 349 | * skip_reg_step |
||
| 350 | * |
||
| 351 | * if the current reg step does not need to run for some reason, |
||
| 352 | * then this will advance SPCO to the next reg step, |
||
| 353 | * and mark the skipped step as completed |
||
| 354 | * |
||
| 355 | * @access public |
||
| 356 | * @param string $reg_step_slug |
||
| 357 | * @return void |
||
| 358 | */ |
||
| 359 | public function skip_reg_step( $reg_step_slug = '' ) { |
||
| 360 | $step_to_skip = $this->find_reg_step( $reg_step_slug ); |
||
| 361 | if ( $step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step() ) { |
||
| 362 | // advance to the next step |
||
| 363 | $this->set_current_step( $this->next_step->slug() ); |
||
| 364 | $step_to_skip->set_is_current_step( false ); |
||
| 365 | $step_to_skip->set_completed(); |
||
| 366 | $this->set_reg_step_initiated( $this->current_step ); |
||
| 367 | } |
||
| 368 | } |
||
| 369 | |||
| 370 | |||
| 371 | |||
| 372 | /** |
||
| 373 | * remove_reg_step |
||
| 374 | * |
||
| 375 | * @access public |
||
| 376 | * @param string $reg_step_slug |
||
| 377 | * @param bool $reset whether to reset reg steps after removal |
||
| 378 | * @throws EE_Error |
||
| 379 | */ |
||
| 380 | public function remove_reg_step( $reg_step_slug = '', $reset = true ) { |
||
| 381 | unset( $this->reg_steps[ $reg_step_slug ] ); |
||
| 382 | if ( $this->transaction instanceof EE_Transaction ) { |
||
| 383 | /** @type EE_Transaction_Processor $transaction_processor */ |
||
| 384 | $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
||
| 385 | // now remove reg step from TXN and save |
||
| 386 | $transaction_processor->remove_reg_step( $this->transaction, $reg_step_slug ); |
||
| 387 | $this->transaction->save(); |
||
| 388 | } |
||
| 389 | if ( $reset ) { |
||
| 390 | $this->reset_reg_steps(); |
||
| 391 | } |
||
| 392 | } |
||
| 393 | |||
| 394 | |||
| 395 | |||
| 396 | /** |
||
| 397 | * set_reg_step_order |
||
| 398 | * |
||
| 399 | * @access public |
||
| 400 | * @param string $reg_step_slug |
||
| 401 | * @param int $order |
||
| 402 | * @return void |
||
| 403 | */ |
||
| 404 | public function set_reg_step_order( $reg_step_slug = '', $order = 100 ) { |
||
| 409 | |||
| 410 | |||
| 411 | |||
| 412 | /** |
||
| 413 | * set_current_step |
||
| 414 | * |
||
| 415 | * @access public |
||
| 416 | * @param string $current_step |
||
| 417 | * @return void |
||
| 418 | */ |
||
| 419 | public function set_current_step( $current_step ) { |
||
| 442 | |||
| 443 | |||
| 444 | |||
| 445 | /** |
||
| 446 | * set_next_step |
||
| 447 | * advances the reg_steps array pointer and sets the next step, then reverses pointer back to the current step |
||
| 448 | * |
||
| 449 | * @access public |
||
| 450 | * @return void |
||
| 451 | */ |
||
| 452 | public function set_next_step() { |
||
| 469 | |||
| 470 | |||
| 471 | |||
| 472 | |||
| 473 | /** |
||
| 474 | * get_next_reg_step |
||
| 475 | * this simply returns the next step from reg_steps array |
||
| 476 | * |
||
| 477 | * @access public |
||
| 478 | * @return EE_SPCO_Reg_Step | null |
||
| 479 | */ |
||
| 480 | public function get_next_reg_step() { |
||
| 485 | |||
| 486 | |||
| 487 | |||
| 488 | |||
| 489 | /** |
||
| 490 | * get_prev_reg_step |
||
| 491 | * this simply returns the previous step from reg_steps array |
||
| 492 | * |
||
| 493 | * @access public |
||
| 494 | * @return EE_SPCO_Reg_Step | null |
||
| 495 | */ |
||
| 496 | public function get_prev_reg_step() { |
||
| 501 | |||
| 502 | |||
| 503 | |||
| 504 | /** |
||
| 505 | * sort_reg_steps |
||
| 506 | * |
||
| 507 | * @access public |
||
| 508 | * @return void |
||
| 509 | */ |
||
| 510 | public function sort_reg_steps() { |
||
| 514 | |||
| 515 | |||
| 516 | |||
| 517 | /** |
||
| 518 | * find_reg_step |
||
| 519 | * finds a reg step by the given slug |
||
| 520 | * |
||
| 521 | * @access public |
||
| 522 | * @param string $reg_step_slug |
||
| 523 | * @return EE_SPCO_Reg_Step|null |
||
| 524 | */ |
||
| 525 | public function find_reg_step( $reg_step_slug = '' ) { |
||
| 526 | if ( ! empty( $reg_step_slug ) ) { |
||
| 527 | // copy reg step array |
||
| 528 | $reg_steps = $this->reg_steps; |
||
| 529 | // set pointer to start of array |
||
| 530 | reset( $reg_steps ); |
||
| 531 | // if there is more than one step |
||
| 532 | if ( count( $reg_steps ) > 1 ) { |
||
| 533 | // advance to the current step and set pointer |
||
| 534 | while ( key( $reg_steps ) != $reg_step_slug && key( $reg_steps ) != '' ) { |
||
| 535 | next( $reg_steps ); |
||
| 536 | } |
||
| 537 | return current( $reg_steps ); |
||
| 538 | } |
||
| 539 | } |
||
| 540 | return null; |
||
| 541 | } |
||
| 542 | |||
| 543 | |||
| 544 | |||
| 545 | /** |
||
| 546 | * reg_step_sorting_callback |
||
| 547 | * |
||
| 548 | * @access public |
||
| 549 | * @param EE_SPCO_Reg_Step $reg_step_A |
||
| 550 | * @param EE_SPCO_Reg_Step $reg_step_B |
||
| 551 | * @return array() |
||
| 552 | */ |
||
| 553 | public function reg_step_sorting_callback( EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B ) { |
||
| 565 | |||
| 566 | |||
| 567 | |||
| 568 | /** |
||
| 569 | * set_reg_step_initiated |
||
| 570 | * |
||
| 571 | * @access public |
||
| 572 | * @param EE_SPCO_Reg_Step $reg_step |
||
| 573 | */ |
||
| 574 | public function set_reg_step_initiated( EE_SPCO_Reg_Step $reg_step ) { |
||
| 575 | // call set_reg_step_initiated ??? |
||
| 576 | if ( |
||
| 577 | // first time visiting SPCO ? |
||
| 578 | ! $this->revisit |
||
| 579 | // and displaying the reg step form for the first time ? |
||
| 580 | && $this->action === 'display_spco_reg_step' |
||
| 581 | ) { |
||
| 582 | /** @type EE_Transaction_Processor $transaction_processor */ |
||
| 583 | $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
||
| 584 | // set the start time for this reg step |
||
| 585 | if ( ! $transaction_processor->set_reg_step_initiated( $this->transaction, $reg_step->slug() ) ) { |
||
| 586 | View Code Duplication | if ( WP_DEBUG ) { |
|
| 587 | EE_Error::add_error( |
||
| 588 | sprintf( |
||
| 589 | __( 'The "%1$s" registration step was not initialized properly.', 'event_espresso' ), |
||
| 590 | $reg_step->name() |
||
| 591 | ), |
||
| 592 | __FILE__, __FUNCTION__, __LINE__ |
||
| 593 | ); |
||
| 594 | } |
||
| 595 | }; |
||
| 596 | } |
||
| 597 | } |
||
| 598 | |||
| 599 | |||
| 600 | |||
| 601 | /** |
||
| 602 | * set_reg_step_JSON_info |
||
| 603 | * |
||
| 604 | * @access public |
||
| 605 | * @return void |
||
| 606 | */ |
||
| 607 | public function set_reg_step_JSON_info() { |
||
| 616 | |||
| 617 | |||
| 618 | |||
| 619 | /** |
||
| 620 | * reset_reg_steps |
||
| 621 | * |
||
| 622 | * @access public |
||
| 623 | * @return bool |
||
| 624 | */ |
||
| 625 | public function reset_reg_steps() { |
||
| 633 | |||
| 634 | |||
| 635 | |||
| 636 | /** |
||
| 637 | * get_registration_time_limit |
||
| 638 | * |
||
| 639 | * @access public |
||
| 640 | * @return string |
||
| 641 | */ |
||
| 642 | public function get_registration_time_limit() { |
||
| 652 | |||
| 653 | |||
| 654 | |||
| 655 | /** |
||
| 656 | * payment_required |
||
| 657 | * @return boolean |
||
| 658 | */ |
||
| 659 | public function payment_required() { |
||
| 668 | |||
| 669 | |||
| 670 | |||
| 671 | /** |
||
| 672 | * initialize_txn_reg_steps_array |
||
| 673 | * |
||
| 674 | * @access public |
||
| 675 | * @return array |
||
| 676 | */ |
||
| 677 | public function initialize_txn_reg_steps_array() { |
||
| 684 | |||
| 685 | |||
| 686 | |||
| 687 | /** |
||
| 688 | * update_txn_reg_steps_array |
||
| 689 | * |
||
| 690 | * @access public |
||
| 691 | * @return bool |
||
| 692 | */ |
||
| 693 | public function update_txn_reg_steps_array() { |
||
| 707 | |||
| 708 | |||
| 709 | |||
| 710 | /** |
||
| 711 | * stash_transaction_and_checkout |
||
| 712 | * |
||
| 713 | * @access public |
||
| 714 | * @return void |
||
| 715 | */ |
||
| 716 | public function stash_transaction_and_checkout() { |
||
| 726 | |||
| 727 | |||
| 728 | |||
| 729 | |||
| 730 | /** |
||
| 731 | * track_transaction_and_registration_status_updates |
||
| 732 | * |
||
| 733 | * stores whether any updates were made to the TXN or it's related registrations |
||
| 734 | * |
||
| 735 | * @access public |
||
| 736 | * @return bool |
||
| 737 | */ |
||
| 738 | public function track_transaction_and_registration_status_updates() { |
||
| 759 | |||
| 760 | |||
| 761 | |||
| 762 | |||
| 763 | /** |
||
| 764 | * visit_allows_processing_of_this_registration |
||
| 765 | * |
||
| 766 | * determines if the current SPCO visit should allow the passed EE_Registration to be used in processing. |
||
| 767 | * one of the following conditions must be met: |
||
| 768 | * EITHER: A) first time thru SPCO -> process ALL registrations ( NOT a revisit ) |
||
| 769 | * OR : B) primary registrant is editing info -> process ALL registrations ( primary_revisit ) |
||
| 770 | * OR : C) another registrant is editing info -> ONLY process their registration ( revisit AND their reg_url_link matches ) |
||
| 771 | * |
||
| 772 | * @access public |
||
| 773 | * @param EE_Registration $registration |
||
| 774 | * @return bool |
||
| 775 | */ |
||
| 776 | public function visit_allows_processing_of_this_registration( EE_Registration $registration ) { |
||
| 779 | |||
| 780 | |||
| 781 | |||
| 782 | /** |
||
| 783 | * _transaction_has_primary_registration |
||
| 784 | * |
||
| 785 | * @access private |
||
| 786 | * @return bool |
||
| 787 | */ |
||
| 788 | public function transaction_has_primary_registrant() { |
||
| 791 | |||
| 792 | |||
| 793 | |||
| 794 | /** |
||
| 795 | * save_all_data |
||
| 796 | * simply loops through the current transaction and saves all data for each registration |
||
| 797 | * |
||
| 798 | * @access public |
||
| 799 | * @param bool $show_errors |
||
| 800 | * @return bool |
||
| 801 | */ |
||
| 802 | public function save_all_data( $show_errors = TRUE ) { |
||
| 819 | |||
| 820 | |||
| 821 | /** |
||
| 822 | * _save_registration_attendee |
||
| 823 | * |
||
| 824 | * @param EE_Registration $registration |
||
| 825 | * @param bool $show_errors |
||
| 826 | * @return void |
||
| 827 | */ |
||
| 828 | private function _save_registration( $registration, $show_errors = TRUE ) { |
||
| 859 | |||
| 860 | |||
| 861 | |||
| 862 | /** |
||
| 863 | * _save_registration_attendee |
||
| 864 | * |
||
| 865 | * @param EE_Registration $registration |
||
| 866 | * @param bool $show_errors |
||
| 867 | * @return void |
||
| 868 | */ |
||
| 869 | private function _save_registration_attendee( $registration, $show_errors = TRUE ) { |
||
| 896 | |||
| 897 | |||
| 898 | |||
| 899 | /** |
||
| 900 | * _save_question_answers |
||
| 901 | * |
||
| 902 | * @param EE_Registration $registration |
||
| 903 | * @param bool $show_errors |
||
| 904 | * @return void |
||
| 905 | */ |
||
| 906 | private function _save_registration_answers( $registration, $show_errors = TRUE ) { |
||
| 931 | |||
| 932 | |||
| 933 | |||
| 934 | /** |
||
| 935 | * refresh_all_entities |
||
| 936 | * will either refresh the entity map with objects form the db or from the checkout cache |
||
| 937 | * |
||
| 938 | * @access public |
||
| 939 | * @param bool $from_db |
||
| 940 | * @return bool |
||
| 941 | */ |
||
| 942 | public function refresh_all_entities( $from_db = false ) { |
||
| 950 | |||
| 951 | |||
| 952 | |||
| 953 | /** |
||
| 954 | * refresh_entity_map |
||
| 955 | * simply loops through the current transaction and updates each |
||
| 956 | * model's entity map using EEM_Base::refresh_entity_map_from_db() |
||
| 957 | * |
||
| 958 | * @access public |
||
| 959 | * @return bool |
||
| 960 | */ |
||
| 961 | protected function refresh_from_db() { |
||
| 988 | |||
| 989 | |||
| 990 | |||
| 991 | /** |
||
| 992 | * _refresh_primary_attendee_obj_from_db |
||
| 993 | * |
||
| 994 | * @param EE_Transaction $transaction |
||
| 995 | * @return EE_Attendee | null |
||
| 996 | */ |
||
| 997 | protected function _refresh_primary_attendee_obj_from_db( EE_Transaction $transaction ) { |
||
| 1021 | |||
| 1022 | |||
| 1023 | |||
| 1024 | /** |
||
| 1025 | * refresh_entity_map |
||
| 1026 | * simply loops through the current transaction and updates |
||
| 1027 | * each model's entity map using EEM_Base::refresh_entity_map_with() |
||
| 1028 | * |
||
| 1029 | * @access public |
||
| 1030 | * @return bool |
||
| 1031 | */ |
||
| 1032 | protected function refresh_entity_map() { |
||
| 1076 | |||
| 1077 | |||
| 1078 | |||
| 1079 | /** |
||
| 1080 | * _refresh_registration |
||
| 1081 | * |
||
| 1082 | * @param string | int $reg_cache_ID |
||
| 1083 | * @param EE_Registration $registration |
||
| 1084 | * @return void |
||
| 1085 | */ |
||
| 1086 | protected function _refresh_registration( $reg_cache_ID, $registration ) { |
||
| 1103 | |||
| 1104 | |||
| 1105 | |||
| 1106 | /** |
||
| 1107 | * _save_registration_attendee |
||
| 1108 | * |
||
| 1109 | * @param EE_Registration $registration |
||
| 1110 | * @return void |
||
| 1111 | */ |
||
| 1112 | protected function _refresh_registration_attendee( $registration ) { |
||
| 1125 | |||
| 1126 | |||
| 1127 | |||
| 1128 | /** |
||
| 1129 | * _refresh_registration_answers |
||
| 1130 | * |
||
| 1131 | * @param EE_Registration $registration |
||
| 1132 | * @return void |
||
| 1133 | */ |
||
| 1134 | protected function _refresh_registration_answers( $registration ) { |
||
| 1152 | |||
| 1153 | |||
| 1154 | |||
| 1155 | /** |
||
| 1156 | * __wakeup |
||
| 1157 | * to conserve db space, we are removing the EE_Checkout object from EE_SPCO_Reg_Step objects upon serialization |
||
| 1158 | * this will reinstate the EE_Checkout object on each EE_SPCO_Reg_Step object |
||
| 1159 | */ |
||
| 1160 | function __wakeup() { |
||
| 1165 | |||
| 1166 | |||
| 1167 | |||
| 1168 | /** |
||
| 1169 | * debug |
||
| 1170 | * |
||
| 1171 | * @param string $class |
||
| 1172 | * @param string $func |
||
| 1173 | * @param string $line |
||
| 1174 | * @param array $info |
||
| 1175 | * @param bool $display_request |
||
| 1176 | */ |
||
| 1177 | function log( $class = '', $func = '', $line = '', $info = array(), $display_request = false ) { |
||
| 1215 | |||
| 1216 | |||
| 1217 | /** |
||
| 1218 | * _strip_objects |
||
| 1219 | * |
||
| 1220 | * @param array $info |
||
| 1221 | * @return array |
||
| 1222 | */ |
||
| 1223 | function _strip_objects( $info = array() ) { |
||
| 1241 | |||
| 1242 | |||
| 1243 | |||
| 1244 | |||
| 1245 | } |
||
| 1246 | // End of file EE_Checkout.class.php |
||
| 1247 | // Location: /EE_Checkout.class.php |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.