Code Duplication    Length = 15-15 lines in 2 locations

core/db_classes/EE_Export.class.php 1 location

@@ 486-500 (lines=15) @@
483
		}
484
485
		//if we couldn't export anything, we want to at least show the column headers
486
		if(empty($registrations_csv_ready_array)){
487
			$reg_csv_array = array();
488
			$model_and_fields_to_include = array(
489
				'Registration' => $reg_fields_to_include,
490
				'Attendee' => $att_fields_to_include
491
			);
492
			foreach($model_and_fields_to_include as $model_name => $field_list){
493
				$model = EE_Registry::instance()->load_model($model_name);
494
				foreach($field_list as $field_name){
495
					$field = $model->field_settings_for($field_name);
496
					$reg_csv_array[$this->_get_column_name_for_field($field)] = null;//$registration->get($field->get_name());
497
				}
498
			}
499
			$registrations_csv_ready_array [] = $reg_csv_array;
500
		}
501
		if( $event_id ){
502
			$event_slug =  EEM_Event::instance()->get_var( array( array( 'EVT_ID' => $event_id ) ), 'EVT_slug' );
503
			if( ! $event_slug ) {

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

@@ 326-340 (lines=15) @@
323
			}
324
		}
325
		//if we couldn't export anything, we want to at least show the column headers
326
		if ( empty( $registrations_csv_ready_array ) ) {
327
			$reg_csv_array = array();
328
			$model_and_fields_to_include = array(
329
				'Registration' => $reg_fields_to_include,
330
				'Attendee'     => $att_fields_to_include
331
			);
332
			foreach ( $model_and_fields_to_include as $model_name => $field_list ) {
333
				$model = \EE_Registry::instance()->load_model( $model_name );
334
				foreach ( $field_list as $field_name ) {
335
					$field = $model->field_settings_for( $field_name );
336
					$reg_csv_array[ \EEH_Export::get_column_name_for_field( $field ) ] = null;
337
				}
338
			}
339
			$registrations_csv_ready_array[] = $reg_csv_array;
340
		}
341
		return $registrations_csv_ready_array;
342
	}
343