Code Duplication    Length = 23-24 lines in 2 locations

includes/admin/reports/class-wc-report-coupon-usage.php 1 location

@@ 125-148 (lines=24) @@
122
	/**
123
	 * Output the report.
124
	 */
125
	public function output_report() {
126
		$ranges = array(
127
			'year'       => __( 'Year', 'woocommerce' ),
128
			'last_month' => __( 'Last Month', 'woocommerce' ),
129
			'month'      => __( 'This Month', 'woocommerce' ),
130
			'7day'       => __( 'Last 7 Days', 'woocommerce' )
131
		);
132
133
		$this->chart_colours = array(
134
			'discount_amount' => '#3498db',
135
			'coupon_count'    => '#d4d9dc',
136
		);
137
138
		$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : '7day';
139
140
		if ( ! in_array( $current_range, array( 'custom', 'year', 'last_month', 'month', '7day' ) ) ) {
141
			$current_range = '7day';
142
		}
143
144
		$this->calculate_current_range( $current_range );
145
146
		include( WC()->plugin_path() . '/includes/admin/views/html-report-by-date.php' );
147
	}
148
149
	/**
150
	 * Get chart widgets.
151
	 *

includes/admin/reports/class-wc-report-sales-by-product.php 1 location

@@ 122-144 (lines=23) @@
119
	/**
120
	 * Output the report.
121
	 */
122
	public function output_report() {
123
		$ranges = array(
124
			'year'       => __( 'Year', 'woocommerce' ),
125
			'last_month' => __( 'Last Month', 'woocommerce' ),
126
			'month'      => __( 'This Month', 'woocommerce' ),
127
			'7day'       => __( 'Last 7 Days', 'woocommerce' )
128
		);
129
130
		$this->chart_colours = array(
131
			'sales_amount' => '#3498db',
132
			'item_count'   => '#d4d9dc',
133
		);
134
135
		$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : '7day';
136
137
		if ( ! in_array( $current_range, array( 'custom', 'year', 'last_month', 'month', '7day' ) ) ) {
138
			$current_range = '7day';
139
		}
140
141
		$this->calculate_current_range( $current_range );
142
143
		include( WC()->plugin_path() . '/includes/admin/views/html-report-by-date.php' );
144
	}
145
146
	/**
147
	 * Get chart widgets.