Code Duplication    Length = 9-9 lines in 2 locations

includes/abstracts/abstract-wc-shipping-method.php 1 location

@@ 472-480 (lines=9) @@
469
	 * Initialise Settings for instances.
470
	 * @since 2.6.0
471
	 */
472
	public function init_instance_settings() {
473
		$this->instance_settings = get_option( $this->get_instance_option_key(), null );
474
475
		// If there are no settings defined, use defaults.
476
		if ( ! is_array( $this->instance_settings ) ) {
477
			$form_fields             = $this->get_instance_form_fields();
478
			$this->instance_settings = array_merge( array_fill_keys( array_keys( $form_fields ), '' ), wp_list_pluck( $form_fields, 'default' ) );
479
		}
480
	}
481
482
	/**
483
	 * Processes and saves options.

includes/abstracts/abstract-wc-settings-api.php 1 location

@@ 223-231 (lines=9) @@
220
	 * @since 1.0.0
221
	 * @uses get_option(), add_option()
222
	 */
223
	public function init_settings() {
224
		$this->settings = get_option( $this->get_option_key(), null );
225
226
		// If there are no settings defined, use defaults.
227
		if ( ! is_array( $this->settings ) ) {
228
			$form_fields    = $this->get_form_fields();
229
			$this->settings = array_merge( array_fill_keys( array_keys( $form_fields ), '' ), wp_list_pluck( $form_fields, 'default' ) );
230
		}
231
	}
232
233
	/**
234
	 * get_option function.