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

@@ 351-365 (lines=15) @@
348
			}
349
		}
350
		//if we couldn't export anything, we want to at least show the column headers
351
		if ( empty( $registrations_csv_ready_array ) ) {
352
			$reg_csv_array = array();
353
			$model_and_fields_to_include = array(
354
				'Registration' => $reg_fields_to_include,
355
				'Attendee'     => $att_fields_to_include
356
			);
357
			foreach ( $model_and_fields_to_include as $model_name => $field_list ) {
358
				$model = \EE_Registry::instance()->load_model( $model_name );
359
				foreach ( $field_list as $field_name ) {
360
					$field = $model->field_settings_for( $field_name );
361
					$reg_csv_array[ \EEH_Export::get_column_name_for_field( $field ) ] = null;
362
				}
363
			}
364
			$registrations_csv_ready_array[] = $reg_csv_array;
365
		}
366
		return $registrations_csv_ready_array;
367
	}
368