Code Duplication    Length = 3-3 lines in 4 locations

includes/class-wc-shipping.php 1 location

@@ 317-319 (lines=3) @@
314
					$this->shipping_total += $rate->cost;
315
316
					if ( ! empty( $rate->taxes ) && is_array( $rate->taxes ) ) {
317
						foreach ( array_keys( $this->shipping_taxes + $rate->taxes ) as $key ) {
318
							$this->shipping_taxes[ $key ] = ( isset( $rate->taxes[$key] ) ? $rate->taxes[$key] : 0 ) + ( isset( $this->shipping_taxes[$key] ) ? $this->shipping_taxes[$key] : 0 );
319
						}
320
					}
321
				}
322
			}

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
@@ 1984-1986 (lines=3) @@
1981
							$this->fees[ $fee_key ]->tax_data = $fee_taxes;
1982
1983
							// Tax rows - merge the totals we just got
1984
							foreach ( array_keys( $this->taxes + $fee_taxes ) as $key ) {
1985
								$this->taxes[ $key ] = ( isset( $fee_taxes[ $key ] ) ? $fee_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
1986
							}
1987
						}
1988
					}
1989
				}