Code Duplication    Length = 4-4 lines in 5 locations

modules/messages/EED_Messages.module.php 2 locations

@@ 581-584 (lines=4) @@
578
		if ( is_array( $req_data['_REG_ID'] ) ) {
579
			foreach ( $req_data['_REG_ID'] as $reg_id ) {
580
				$reg = EE_Registry::instance()->load_model( 'Registration' )->get_one_by_ID( $reg_id );
581
				if ( ! $reg instanceof EE_Registration ) {
582
					EE_Error::add_error( sprintf( __('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $req_data['_REG_ID'] ) );
583
					return false;
584
				}
585
				$regs_to_send[$reg->transaction_ID()][$reg->status_ID()][] = $reg;
586
			}
587
		} else {
@@ 593-596 (lines=4) @@
590
			$reg = EE_Registry::instance()->load_model('Registration')->get_one_by_ID( $req_data['_REG_ID'] );
591
592
			//if no reg object then send error
593
			if ( ! $reg instanceof EE_Registration ) {
594
				EE_Error::add_error( sprintf( __('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $req_data['_REG_ID'] ) );
595
				return false;
596
			}
597
598
			$regs_to_send[$reg->transaction_ID()][$reg->status_ID()][] = $reg;
599
		}

modules/single_page_checkout/reg_steps/attendee_information/EE_SPCO_Reg_Step_Attendee_Information.class.php 1 location

@@ 682-685 (lines=4) @@
679
		// grab the saved registrations from the transaction
680
		foreach ( $registrations  as $registration ) {
681
			// verify EE_Registration object
682
			if ( ! $registration instanceof EE_Registration ) {
683
				EE_Error::add_error( __( 'An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
684
				return FALSE;
685
			}
686
			$reg_url_link = $registration->reg_url_link();
687
			// reg_url_link exists ?
688
			if ( $reg_url_link ) {

modules/single_page_checkout/EED_Single_Page_Checkout.module.php 2 locations

@@ 890-893 (lines=4) @@
887
		// if returning to SPCO, then verify that primary registrant is set
888
		if ( ! empty( $this->checkout->reg_url_link )) {
889
			$valid_registrant = $this->checkout->transaction->primary_registration();
890
			if ( ! $valid_registrant instanceof EE_Registration ) {
891
				EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
892
				return false;
893
			}
894
			$valid_registrant = null;
895
			foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) {
896
				if ( $registration instanceof EE_Registration ) {
@@ 902-905 (lines=4) @@
899
					}
900
				}
901
			}
902
			if ( ! $valid_registrant instanceof EE_Registration ) {
903
				EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
904
				return false;
905
			}
906
		}
907
		// now that things have been kinda sufficiently verified,
908
		// let's add the checkout to the session so that's available other systems