Code Duplication    Length = 16-16 lines in 2 locations

modules/google-analytics/classes/wp-google-analytics-universal.php 1 location

@@ 253-268 (lines=16) @@
250
	/**
251
	* Adds the product ID and SKU to the remove product link (for use by remove_from_cart above) if not present
252
	*/
253
	public function remove_from_cart_attributes( $url, $key ) {
254
		if ( false !== strpos( $url, 'data-product_id' ) ) {
255
			return $url;
256
		}
257
258
		$item = WC()->cart->get_cart_item( $key );
259
		$product = $item[ 'data' ];
260
261
		$new_attributes = sprintf( 'href="%s" data-product_id="%s" data-product_sku="%s"',
262
			esc_attr( $url ),
263
			esc_attr( $product->get_id() ),
264
			esc_attr( $product->get_sku() )
265
			);
266
		$url = str_replace( 'href=', $new_attributes );
267
		return $url;
268
	}
269
270
	public function listing_impression() {
271
		if ( ! Jetpack_Google_Analytics_Options::enhanced_ecommerce_tracking_is_enabled() ) {

modules/woocommerce-analytics/classes/wp-woocommerce-analytics-universal.php 1 location

@@ 168-183 (lines=16) @@
165
	 * @param string $key key.
166
	 * @return mixed.
167
	 */
168
	public function remove_from_cart_attributes( $url, $key ) {
169
		if ( false !== strpos( $url, 'data-product_id' ) ) {
170
			return $url;
171
		}
172
173
		$item    = WC()->cart->get_cart_item( $key );
174
		$product = $item['data'];
175
176
		$new_attributes = sprintf(
177
			'href="%s" data-product_id="%s" data-product_sku="%s"',
178
			esc_attr( $url ),
179
			esc_attr( $product->get_id() ),
180
			esc_attr( $product->get_sku() )
181
		);
182
		$url = str_replace( 'href=', $new_attributes );
183
		return $url;
184
	}
185
186
	/**