Code Duplication    Length = 15-15 lines in 2 locations

core/helpers/EEH_Export.helper.php 1 location

@@ 132-146 (lines=15) @@
129
	 * @param boolean|string $pretty_schema true to display pretty, a string to use a specific "Schema", or false to NOT display pretty
130
	 * @return string
131
	 */
132
	public static function prepare_value_from_db_for_display( $model, $field_name,  $raw_db_value, $pretty_schema = true ) {
133
		$field_obj = $model->field_settings_for( $field_name );
134
		$value_on_model_obj = $field_obj->prepare_for_set_from_db( $raw_db_value );
135
		if( $field_obj instanceof EE_Datetime_Field ) {
136
			$field_obj->set_date_format( EEH_Export::get_date_format_for_export( $field_obj->get_date_format( $pretty_schema ) ), $pretty_schema );
137
			$field_obj->set_time_format( EEH_Export::get_time_format_for_export( $field_obj->get_time_format( $pretty_schema ) ), $pretty_schema );
138
		}
139
		if( $pretty_schema === true){
140
			return $field_obj->prepare_for_pretty_echoing( $value_on_model_obj );
141
		}elseif( is_string( $pretty_schema ) ) {
142
			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema );
143
		}else{
144
			return $field_obj->prepare_for_get( $value_on_model_obj );
145
		}
146
	}
147
148
149

core/db_classes/EE_Export.class.php 1 location

@@ 288-302 (lines=15) @@
285
	 * @param boolean|string $pretty_schema true to display pretty, a string to use a specific "Schema", or false to NOT display pretty
286
	 * @return string
287
	 */
288
	protected function _prepare_value_from_db_for_display( $model, $field_name,  $raw_db_value, $pretty_schema = true ) {
289
		$field_obj = $model->field_settings_for( $field_name );
290
		$value_on_model_obj = $field_obj->prepare_for_set_from_db( $raw_db_value );
291
		if( $field_obj instanceof EE_Datetime_Field ) {
292
			$field_obj->set_date_format( EE_CSV::instance()->get_date_format_for_csv( $field_obj->get_date_format( $pretty_schema ) ), $pretty_schema );
293
			$field_obj->set_time_format( EE_CSV::instance()->get_time_format_for_csv( $field_obj->get_time_format( $pretty_schema ) ), $pretty_schema );
294
		}
295
		if( $pretty_schema === true){
296
			return $field_obj->prepare_for_pretty_echoing( $value_on_model_obj );
297
		}elseif( is_string( $pretty_schema ) ) {
298
			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema );
299
		}else{
300
			return $field_obj->prepare_for_get( $value_on_model_obj );
301
		}
302
	}
303
304
	/**
305
	 * Export a custom CSV of registration info including: A bunch of the reg fields, the time of the event, the price name,