Code Duplication    Length = 17-20 lines in 2 locations

includes/admin/settings/class-wc-settings-checkout.php 1 location

@@ 42-58 (lines=17) @@
39
	 *
40
	 * @return array
41
	 */
42
	public function get_sections() {
43
		$sections = array(
44
			'' => __( 'Checkout Options', 'woocommerce' )
45
		);
46
47
		if ( ! defined( 'WC_INSTALLING' ) ) {
48
			// Load shipping methods so we can show any global options they may have.
49
			$payment_gateways = WC()->payment_gateways->payment_gateways();
50
51
			foreach ( $payment_gateways as $gateway ) {
52
				$title = empty( $gateway->method_title ) ? ucfirst( $gateway->id ) : $gateway->method_title;
53
				$sections[ strtolower( get_class( $gateway ) ) ] = esc_html( $title );
54
			}
55
		}
56
57
		return apply_filters( 'woocommerce_get_sections_' . $this->id, $sections );
58
	}
59
60
	/**
61
	 * Get settings array.

includes/admin/settings/class-wc-settings-shipping.php 1 location

@@ 40-59 (lines=20) @@
37
	 *
38
	 * @return array
39
	 */
40
	public function get_sections() {
41
		$sections = array(
42
			'' => __( 'Shipping Options', 'woocommerce' )
43
		);
44
45
		if ( ! defined( 'WC_INSTALLING' ) ) {
46
			// Load shipping methods so we can show any global options they may have
47
			$shipping_methods = WC()->shipping->load_shipping_methods();
48
49
			foreach ( $shipping_methods as $method ) {
50
				if ( ! $method->has_settings() ) {
51
					continue;
52
				}
53
				$title = empty( $method->method_title ) ? ucfirst( $method->id ) : $method->method_title;
54
				$sections[ strtolower( get_class( $method ) ) ] = esc_html( $title );
55
			}
56
		}
57
58
		return apply_filters( 'woocommerce_get_sections_' . $this->id, $sections );
59
	}
60
61
	/**
62
	 * Get settings array.