Code Duplication    Length = 15-15 lines in 2 locations

core/db_classes/EE_Export.class.php 1 location

@@ 230-244 (lines=15) @@
227
			) 
228
		);
229
		$csv_data = array();
230
		foreach( $attendee_rows as $attendee_row ){
231
			$csv_row = array();
232
			foreach( EEM_Attendee::instance()->field_settings() as $field_name => $field_obj ){
233
				if( $field_name == 'STA_ID' ){
234
					$state_name_field = EEM_State::instance()->field_settings_for( 'STA_name' );
235
					$csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ];
236
				}elseif( $field_name == 'CNT_ISO' ){
237
					$country_name_field = EEM_Country::instance()->field_settings_for( 'CNT_name' );
238
					$csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ];
239
				}else{
240
					$csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ];
241
				}
242
			}
243
			$csv_data[] = $csv_row;
244
		}
245
246
		$filename = $this->generate_filename ( 'contact-list-report' );
247

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

@@ 97-111 (lines=15) @@
94
			) 
95
		);
96
		$csv_data = array();
97
		foreach( $attendee_rows as $attendee_row ){
98
			$csv_row = array();
99
			foreach( \EEM_Attendee::instance()->field_settings() as $field_name => $field_obj ){
100
				if( $field_name == 'STA_ID' ){
101
					$state_name_field = \EEM_State::instance()->field_settings_for( 'STA_name' );
102
					$csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ];
103
				}elseif( $field_name == 'CNT_ISO' ){
104
					$country_name_field = \EEM_Country::instance()->field_settings_for( 'CNT_name' );
105
					$csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ];
106
				}else{
107
					$csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ];
108
				}
109
			}
110
			$csv_data[] = $csv_row;
111
		}
112
		return $csv_data;
113
	}
114