Code Duplication    Length = 3-3 lines in 4 locations

includes/class-wc-cart.php 3 locations

@@ 1291-1293 (lines=3) @@
1288
					}
1289
1290
					// Tax rows - merge the totals we just got
1291
					foreach ( array_keys( $this->taxes + $discounted_taxes ) as $key ) {
1292
						$this->taxes[ $key ] = ( isset( $discounted_taxes[ $key ] ) ? $discounted_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
1293
					}
1294
1295
				/**
1296
				 * Prices exclude tax.
@@ 1317-1319 (lines=3) @@
1314
					$line_total            = $discounted_price * $values['quantity'];
1315
1316
					// Tax rows - merge the totals we just got
1317
					foreach ( array_keys( $this->taxes + $discounted_taxes ) as $key ) {
1318
						$this->taxes[ $key ] = ( isset( $discounted_taxes[ $key ] ) ? $discounted_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
1319
					}
1320
				}
1321
1322
				// Cart contents total is based on discounted prices and is used for the final total calculation
@@ 1985-1987 (lines=3) @@
1982
							$this->fees[ $fee_key ]->tax_data = $fee_taxes;
1983
1984
							// Tax rows - merge the totals we just got
1985
							foreach ( array_keys( $this->taxes + $fee_taxes ) as $key ) {
1986
								$this->taxes[ $key ] = ( isset( $fee_taxes[ $key ] ) ? $fee_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
1987
							}
1988
						}
1989
					}
1990
				}

includes/class-wc-shipping.php 1 location

@@ 297-299 (lines=3) @@
294
					$this->shipping_total += $rate->cost;
295
296
					if ( ! empty( $rate->taxes ) && is_array( $rate->taxes ) ) {
297
						foreach ( array_keys( $this->shipping_taxes + $rate->taxes ) as $key ) {
298
							$this->shipping_taxes[ $key ] = ( isset( $rate->taxes[$key] ) ? $rate->taxes[$key] : 0 ) + ( isset( $this->shipping_taxes[$key] ) ? $this->shipping_taxes[$key] : 0 );
299
						}
300
					}
301
				}
302
			}