Code Duplication    Length = 15-15 lines in 2 locations

core/db_classes/EE_Export.class.php 1 location

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

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

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