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

@@ 1328-1330 (lines=3) @@
1325
					}
1326
1327
					// Tax rows - merge the totals we just got
1328
					foreach ( array_keys( $this->taxes + $discounted_taxes ) as $key ) {
1329
						$this->taxes[ $key ] = ( isset( $discounted_taxes[ $key ] ) ? $discounted_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
1330
					}
1331
1332
				/**
1333
				 * Prices exclude tax.
@@ 1354-1356 (lines=3) @@
1351
					$line_total            = $discounted_price * $values['quantity'];
1352
1353
					// Tax rows - merge the totals we just got
1354
					foreach ( array_keys( $this->taxes + $discounted_taxes ) as $key ) {
1355
						$this->taxes[ $key ] = ( isset( $discounted_taxes[ $key ] ) ? $discounted_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
1356
					}
1357
				}
1358
1359
				// Cart contents total is based on discounted prices and is used for the final total calculation
@@ 2019-2021 (lines=3) @@
2016
							$this->fees[ $fee_key ]->tax_data = $fee_taxes;
2017
2018
							// Tax rows - merge the totals we just got
2019
							foreach ( array_keys( $this->taxes + $fee_taxes ) as $key ) {
2020
								$this->taxes[ $key ] = ( isset( $fee_taxes[ $key ] ) ? $fee_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
2021
							}
2022
						}
2023
					}
2024
				}