Code Duplication    Length = 3-3 lines in 4 locations

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
			}

includes/class-wc-cart.php 3 locations

@@ 1348-1350 (lines=3) @@
1345
					}
1346
1347
					// Tax rows - merge the totals we just got
1348
					foreach ( array_keys( $this->taxes + $discounted_taxes ) as $key ) {
1349
						$this->taxes[ $key ] = ( isset( $discounted_taxes[ $key ] ) ? $discounted_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
1350
					}
1351
1352
				/**
1353
				 * Prices exclude tax.
@@ 1374-1376 (lines=3) @@
1371
					$line_total            = $discounted_price * $values['quantity'];
1372
1373
					// Tax rows - merge the totals we just got
1374
					foreach ( array_keys( $this->taxes + $discounted_taxes ) as $key ) {
1375
						$this->taxes[ $key ] = ( isset( $discounted_taxes[ $key ] ) ? $discounted_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
1376
					}
1377
				}
1378
1379
				// Cart contents total is based on discounted prices and is used for the final total calculation
@@ 2040-2042 (lines=3) @@
2037
							$this->fees[ $fee_key ]->tax_data = $fee_taxes;
2038
2039
							// Tax rows - merge the totals we just got
2040
							foreach ( array_keys( $this->taxes + $fee_taxes ) as $key ) {
2041
								$this->taxes[ $key ] = ( isset( $fee_taxes[ $key ] ) ? $fee_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
2042
							}
2043
						}
2044
					}
2045
				}