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

@@ 393-407 (lines=15) @@
390
            }
391
        }
392
        //if we couldn't export anything, we want to at least show the column headers
393
        if (empty($registrations_csv_ready_array)) {
394
            $reg_csv_array = array();
395
            $model_and_fields_to_include = array(
396
                'Registration' => $reg_fields_to_include,
397
                'Attendee'     => $att_fields_to_include,
398
            );
399
            foreach ($model_and_fields_to_include as $model_name => $field_list) {
400
                $model = \EE_Registry::instance()->load_model($model_name);
401
                foreach ($field_list as $field_name) {
402
                    $field = $model->field_settings_for($field_name);
403
                    $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = null;
404
                }
405
            }
406
            $registrations_csv_ready_array[] = $reg_csv_array;
407
        }
408
        return $registrations_csv_ready_array;
409
    }
410