Code Duplication    Length = 9-9 lines in 3 locations

includes/class-wc-stripe-helper.php 3 locations

@@ 42-50 (lines=9) @@
39
	 * @param object $order
40
	 * @param string $currency
41
	 */
42
	public static function update_stripe_currency( $order = null, $currency ) {
43
		if ( is_null( $order ) ) {
44
			return false;
45
		}
46
47
		$order_id = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->id : $order->get_id();
48
49
		WC_Stripe_Helper::is_wc_lt( '3.0' ) ? update_post_meta( $order_id, self::META_NAME_STRIPE_CURRENCY, $currency ) : $order->update_meta_data( self::META_NAME_STRIPE_CURRENCY, $currency );
50
	}
51
52
	/**
53
	 * Gets the Stripe fee for order. With legacy check.
@@ 88-96 (lines=9) @@
85
	 * @param object $order
86
	 * @param float $amount
87
	 */
88
	public static function update_stripe_fee( $order = null, $amount = 0.0 ) {
89
		if ( is_null( $order ) ) {
90
			return false;
91
		}
92
93
		$order_id = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->id : $order->get_id();
94
95
		WC_Stripe_Helper::is_wc_lt( '3.0' ) ? update_post_meta( $order_id, self::META_NAME_FEE, $amount ) : $order->update_meta_data( self::META_NAME_FEE, $amount );
96
	}
97
98
	/**
99
	 * Deletes the Stripe fee for order.
@@ 151-159 (lines=9) @@
148
	 * @param object $order
149
	 * @param float $amount
150
	 */
151
	public static function update_stripe_net( $order = null, $amount = 0.0 ) {
152
		if ( is_null( $order ) ) {
153
			return false;
154
		}
155
156
		$order_id = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->id : $order->get_id();
157
158
		WC_Stripe_Helper::is_wc_lt( '3.0' ) ? update_post_meta( $order_id, self::META_NAME_NET, $amount ) : $order->update_meta_data( self::META_NAME_NET, $amount );
159
	}
160
161
	/**
162
	 * Deletes the Stripe net for order.