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

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