Code Duplication    Length = 3-3 lines in 4 locations

includes/class-wc-cart.php 3 locations

@@ 1324-1326 (lines=3) @@
1321
					}
1322
1323
					// Tax rows - merge the totals we just got
1324
					foreach ( array_keys( $this->taxes + $discounted_taxes ) as $key ) {
1325
						$this->taxes[ $key ] = ( isset( $discounted_taxes[ $key ] ) ? $discounted_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
1326
					}
1327
1328
				/**
1329
				 * Prices exclude tax.
@@ 1350-1352 (lines=3) @@
1347
					$line_total            = $discounted_price * $values['quantity'];
1348
1349
					// Tax rows - merge the totals we just got
1350
					foreach ( array_keys( $this->taxes + $discounted_taxes ) as $key ) {
1351
						$this->taxes[ $key ] = ( isset( $discounted_taxes[ $key ] ) ? $discounted_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
1352
					}
1353
				}
1354
1355
				// Cart contents total is based on discounted prices and is used for the final total calculation
@@ 2026-2028 (lines=3) @@
2023
							$this->fees[ $fee_key ]->tax_data = $fee_taxes;
2024
2025
							// Tax rows - merge the totals we just got
2026
							foreach ( array_keys( $this->taxes + $fee_taxes ) as $key ) {
2027
								$this->taxes[ $key ] = ( isset( $fee_taxes[ $key ] ) ? $fee_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
2028
							}
2029
						}
2030
					}
2031
				}

includes/class-wc-shipping.php 1 location

@@ 306-308 (lines=3) @@
303
					$this->shipping_total += $rate->cost;
304
305
					if ( ! empty( $rate->taxes ) && is_array( $rate->taxes ) ) {
306
						foreach ( array_keys( $this->shipping_taxes + $rate->taxes ) as $key ) {
307
							$this->shipping_taxes[ $key ] = ( isset( $rate->taxes[$key] ) ? $rate->taxes[$key] : 0 ) + ( isset( $this->shipping_taxes[$key] ) ? $this->shipping_taxes[$key] : 0 );
308
						}
309
					}
310
				}
311
			}