Code Duplication    Length = 3-3 lines in 4 locations

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
			}

includes/class-wc-cart.php 3 locations

@@ 1314-1316 (lines=3) @@
1311
					}
1312
1313
					// Tax rows - merge the totals we just got
1314
					foreach ( array_keys( $this->taxes + $discounted_taxes ) as $key ) {
1315
						$this->taxes[ $key ] = ( isset( $discounted_taxes[ $key ] ) ? $discounted_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
1316
					}
1317
1318
				/**
1319
				 * Prices exclude tax.
@@ 1340-1342 (lines=3) @@
1337
					$line_total            = $discounted_price * $values['quantity'];
1338
1339
					// Tax rows - merge the totals we just got
1340
					foreach ( array_keys( $this->taxes + $discounted_taxes ) as $key ) {
1341
						$this->taxes[ $key ] = ( isset( $discounted_taxes[ $key ] ) ? $discounted_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
1342
					}
1343
				}
1344
1345
				// Cart contents total is based on discounted prices and is used for the final total calculation
@@ 2008-2010 (lines=3) @@
2005
							$this->fees[ $fee_key ]->tax_data = $fee_taxes;
2006
2007
							// Tax rows - merge the totals we just got
2008
							foreach ( array_keys( $this->taxes + $fee_taxes ) as $key ) {
2009
								$this->taxes[ $key ] = ( isset( $fee_taxes[ $key ] ) ? $fee_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
2010
							}
2011
						}
2012
					}
2013
				}