Code Duplication    Length = 13-14 lines in 2 locations

includes/admin/class-wc-admin-dashboard.php 2 locations

@@ 94-107 (lines=14) @@
91
		$nostock        = absint( max( get_option( 'woocommerce_notify_no_stock_amount' ), 0 ) );
92
		$transient_name = 'wc_low_stock_count';
93
94
		if ( false === ( $lowinstock_count = get_transient( $transient_name ) ) ) {
95
			$query_from = apply_filters( 'woocommerce_report_low_in_stock_query_from', "FROM {$wpdb->posts} as posts
96
				INNER JOIN {$wpdb->postmeta} AS postmeta ON posts.ID = postmeta.post_id
97
				INNER JOIN {$wpdb->postmeta} AS postmeta2 ON posts.ID = postmeta2.post_id
98
				WHERE 1=1
99
				AND posts.post_type IN ( 'product', 'product_variation' )
100
				AND posts.post_status = 'publish'
101
				AND postmeta2.meta_key = '_manage_stock' AND postmeta2.meta_value = 'yes'
102
				AND postmeta.meta_key = '_stock' AND CAST(postmeta.meta_value AS SIGNED) <= '{$stock}'
103
				AND postmeta.meta_key = '_stock' AND CAST(postmeta.meta_value AS SIGNED) > '{$nostock}'
104
			" );
105
			$lowinstock_count = absint( $wpdb->get_var( "SELECT COUNT( DISTINCT posts.ID ) {$query_from};" ) );
106
			set_transient( $transient_name, $lowinstock_count, DAY_IN_SECONDS * 30 );
107
		}
108
109
		$transient_name = 'wc_outofstock_count';
110
@@ 111-123 (lines=13) @@
108
109
		$transient_name = 'wc_outofstock_count';
110
111
		if ( false === ( $outofstock_count = get_transient( $transient_name ) ) ) {
112
			$query_from = apply_filters( 'woocommerce_report_out_of_stock_query_from', "FROM {$wpdb->posts} as posts
113
				INNER JOIN {$wpdb->postmeta} AS postmeta ON posts.ID = postmeta.post_id
114
				INNER JOIN {$wpdb->postmeta} AS postmeta2 ON posts.ID = postmeta2.post_id
115
				WHERE 1=1
116
				AND posts.post_type IN ( 'product', 'product_variation' )
117
				AND posts.post_status = 'publish'
118
				AND postmeta2.meta_key = '_manage_stock' AND postmeta2.meta_value = 'yes'
119
				AND postmeta.meta_key = '_stock' AND CAST(postmeta.meta_value AS SIGNED) <= '{$nostock}'
120
			" );
121
			$outofstock_count = absint( $wpdb->get_var( "SELECT COUNT( DISTINCT posts.ID ) {$query_from};" ) );
122
			set_transient( $transient_name, $outofstock_count, DAY_IN_SECONDS * 30 );
123
		}
124
		?>
125
		<ul class="wc_status_list">
126
			<li class="sales-this-month">