Code Duplication    Length = 5-5 lines in 3 locations

payment_methods/Paypal_Express/EEG_Paypal_Express.gateway.php 3 locations

@@ 119-123 (lines=5) @@
116
     * @throws \EE_Error
117
     */
118
	public function set_redirection_info( $payment, $billing_info = array(), $return_url = NULL, $notify_url = NULL, $cancel_url = NULL ) {
119
		if ( ! $payment instanceof EEI_Payment ) {
120
			$payment->set_gateway_response( __( 'Error. No associated payment was found.', 'event_espresso' ) );
121
			$payment->set_status( $this->_pay_model->failed_status() );
122
			return $payment;
123
		}
124
		$transaction = $payment->transaction();
125
		if ( ! $transaction instanceof EEI_Transaction ) {
126
			$payment->set_gateway_response( __( 'Could not process this payment because it has no associated transaction.', 'event_espresso' ) );
@@ 125-129 (lines=5) @@
122
			return $payment;
123
		}
124
		$transaction = $payment->transaction();
125
		if ( ! $transaction instanceof EEI_Transaction ) {
126
			$payment->set_gateway_response( __( 'Could not process this payment because it has no associated transaction.', 'event_espresso' ) );
127
			$payment->set_status( $this->_pay_model->failed_status() );
128
			return $payment;
129
		}
130
		$order_description = substr( $this->_format_order_description($payment), 0, 127 );
131
		$primary_registration = $transaction->primary_registration();
132
		$primary_attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() : false;
@@ 289-293 (lines=5) @@
286
		if ( $payment instanceof EEI_Payment ) {
287
			$this->log( array( 'Return from Authorization' => $update_info ), $payment );
288
			$transaction = $payment->transaction();
289
			if ( ! $transaction instanceof EEI_Transaction ) {
290
				$payment->set_gateway_response( __( 'Could not process this payment because it has no associated transaction.', 'event_espresso' ) );
291
				$payment->set_status( $this->_pay_model->failed_status() );
292
				return $payment;
293
			}
294
			$primary_registrant = $transaction->primary_registration();
295
            $payment_details = $payment->details();
296
            // Check if we still have the token.