Code Duplication    Length = 5-5 lines in 3 locations

includes/cli/class-wc-cli-tax.php 1 location

@@ 674-678 (lines=5) @@
671
				WHERE tax_rate_id = %d
672
			", $id ) );
673
674
			if ( ! is_wp_error( $tax ) && ! is_null( $tax ) ) {
675
				foreach ( $locales as $locale ) {
676
					$tax_data[ $locale->location_type ] = $locale->location_code;
677
				}
678
			}
679
680
			$items[] = $tax_data;
681
		}

includes/api/class-wc-rest-taxes-controller.php 1 location

@@ 487-491 (lines=5) @@
484
			WHERE tax_rate_id = %d
485
		", $id ) );
486
487
		if ( ! is_wp_error( $tax ) && ! is_null( $tax ) ) {
488
			foreach ( $locales as $locale ) {
489
				$data[ $locale->location_type ] = $locale->location_code;
490
			}
491
		}
492
493
		$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
494
		$data    = $this->add_additional_fields_to_object( $data, $request );

includes/api/legacy/v3/class-wc-api-taxes.php 1 location

@@ 160-164 (lines=5) @@
157
				WHERE tax_rate_id = %d
158
			", $id ) );
159
160
			if ( ! is_wp_error( $tax ) && ! is_null( $tax ) ) {
161
				foreach ( $locales as $locale ) {
162
					$tax_data[ $locale->location_type ] = $locale->location_code;
163
				}
164
			}
165
166
			return array( 'tax' => apply_filters( 'woocommerce_api_tax_response', $tax_data, $tax, $fields, $this ) );
167
		} catch ( WC_API_Exception $e ) {