Code Duplication    Length = 8-9 lines in 3 locations

includes/class-give-db-logs.php 3 locations

@@ 324-332 (lines=9) @@
321
		}
322
323
		// Specific logs.
324
		if ( ! empty( $args['ID'] ) ) {
325
326
			if ( ! is_array( $args['ID'] ) ) {
327
				$args['ID'] = explode( ',', $args['ID'] );
328
			}
329
			$log_ids = implode( ',', array_map( 'intval', $args['ID'] ) );
330
331
			$where .= " AND {$this->table_name}.ID IN( {$log_ids} ) ";
332
		}
333
334
		// Logs created for a specific date or in a date range
335
		if ( ! empty( $args['date_query'] ) ) {
@@ 341-348 (lines=8) @@
338
		}
339
340
		// Logs create for specific parent.
341
		if ( ! empty( $args['log_parent'] ) ) {
342
			if ( ! is_array( $args['log_parent'] ) ) {
343
				$args['log_parent'] = explode( ',', $args['log_parent'] );
344
			}
345
			$parent_ids = implode( ',', array_map( 'intval', $args['log_parent'] ) );
346
347
			$where .= " AND {$this->table_name}.log_parent IN( {$parent_ids} ) ";
348
		}
349
350
		// Logs create for specific type.
351
		// is_array check is for backward compatibility.
@@ 352-360 (lines=9) @@
349
350
		// Logs create for specific type.
351
		// is_array check is for backward compatibility.
352
		if ( ! empty( $args['log_type'] ) && ! is_array( $args['log_type'] ) ) {
353
			if ( ! is_array( $args['log_type'] ) ) {
354
				$args['log_type'] = explode( ',', $args['log_type'] );
355
			}
356
357
			$log_types = implode( '\',\'', array_map( 'trim', $args['log_type'] ) );
358
359
			$where .= " AND {$this->table_name}.log_type IN( '{$log_types}' ) ";
360
		}
361
362
		$args['orderby'] = ! array_key_exists( $args['orderby'], $this->get_columns() ) ? 'log_date' : $args['orderby'];
363