Code Duplication    Length = 20-20 lines in 2 locations

core/libraries/batch/JobHandlers/RegistrationsReport.php 1 location

@@ 343-362 (lines=20) @@
340
                $payment_methods = array();
341
                $gateway_txn_ids_etc = array();
342
                $payment_times = array();
343
                if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) {
344
                    $payments_info = \EEM_Payment::instance()->get_all_wpdb_results(
345
                        array(
346
                            array(
347
                                'TXN_ID' => $reg_row['TransactionTable.TXN_ID'],
348
                                'STS_ID' => \EEM_Payment::status_id_approved,
349
                            ),
350
                            'force_join' => array('Payment_Method'),
351
                        ),
352
                        ARRAY_A,
353
                        'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time'
354
                    );
355
                    foreach ($payments_info as $payment_method_and_gateway_txn_id) {
356
                        $payment_methods[] = isset($payment_method_and_gateway_txn_id['name'])
357
                            ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso');
358
                        $gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id'])
359
                            ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : '';
360
                        $payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time'])
361
                            ? $payment_method_and_gateway_txn_id['payment_time'] : '';
362
                    }
363
                }
364
                $reg_csv_array[ __('Payment Date(s)', 'event_espresso') ] = implode(',', $payment_times);
365
                $reg_csv_array[ __('Payment Method(s)', 'event_espresso') ] = implode(",", $payment_methods);

core/db_classes/EE_Export.class.php 1 location

@@ 504-523 (lines=20) @@
501
                $payment_methods = array();
502
                $gateway_txn_ids_etc = array();
503
                $payment_times = array();
504
                if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) {
505
                    $payments_info = EEM_Payment::instance()->get_all_wpdb_results(
506
                        array(
507
                            array(
508
                                'TXN_ID' => $reg_row['TransactionTable.TXN_ID'],
509
                                'STS_ID' => EEM_Payment::status_id_approved,
510
                            ),
511
                            'force_join' => array('Payment_Method'),
512
                        ),
513
                        ARRAY_A,
514
                        'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time'
515
                    );
516
517
                    foreach ($payments_info as $payment_method_and_gateway_txn_id) {
518
                        $payment_methods[] = isset($payment_method_and_gateway_txn_id['name'])
519
                            ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso');
520
                        $gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id'])
521
                            ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : '';
522
                        $payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time'])
523
                            ? $payment_method_and_gateway_txn_id['payment_time'] : '';
524
                    }
525
                }
526
                $reg_csv_array[ __('Payment Date(s)', 'event_espresso') ] = implode(',', $payment_times);