Code Duplication    Length = 3-3 lines in 4 locations

includes/class-wc-shipping.php 1 location

@@ 280-282 (lines=3) @@
277
					$this->shipping_total += $rate->cost;
278
279
					if ( ! empty( $rate->taxes ) && is_array( $rate->taxes ) ) {
280
						foreach ( array_keys( $this->shipping_taxes + $rate->taxes ) as $key ) {
281
							$this->shipping_taxes[ $key ] = ( isset( $rate->taxes[$key] ) ? $rate->taxes[$key] : 0 ) + ( isset( $this->shipping_taxes[$key] ) ? $this->shipping_taxes[$key] : 0 );
282
						}
283
					}
284
				}
285
			}

includes/class-wc-cart.php 3 locations

@@ 1321-1323 (lines=3) @@
1318
					}
1319
1320
					// Tax rows - merge the totals we just got
1321
					foreach ( array_keys( $this->taxes + $discounted_taxes ) as $key ) {
1322
						$this->taxes[ $key ] = ( isset( $discounted_taxes[ $key ] ) ? $discounted_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
1323
					}
1324
1325
				/**
1326
				 * Prices exclude tax.
@@ 1347-1349 (lines=3) @@
1344
					$line_total            = $discounted_price * $values['quantity'];
1345
1346
					// Tax rows - merge the totals we just got
1347
					foreach ( array_keys( $this->taxes + $discounted_taxes ) as $key ) {
1348
						$this->taxes[ $key ] = ( isset( $discounted_taxes[ $key ] ) ? $discounted_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
1349
					}
1350
				}
1351
1352
				// Cart contents total is based on discounted prices and is used for the final total calculation
@@ 2014-2016 (lines=3) @@
2011
							$this->fees[ $fee_key ]->tax_data = $fee_taxes;
2012
2013
							// Tax rows - merge the totals we just got
2014
							foreach ( array_keys( $this->taxes + $fee_taxes ) as $key ) {
2015
								$this->taxes[ $key ] = ( isset( $fee_taxes[ $key ] ) ? $fee_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
2016
							}
2017
						}
2018
					}
2019
				}