Code Duplication    Length = 9-9 lines in 2 locations

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

@@ 160-168 (lines=9) @@
157
	 * @since 1.0.0
158
	 * @uses get_option(), add_option()
159
	 */
160
	public function init_settings() {
161
		$this->settings = get_option( $this->get_option_key(), null );
162
163
		// If there are no settings defined, use defaults.
164
		if ( ! is_array( $this->settings ) ) {
165
			$form_fields    = $this->get_form_fields();
166
			$this->settings = array_merge( array_fill_keys( array_keys( $form_fields ), '' ), wp_list_pluck( $form_fields, 'default' ) );
167
		}
168
	}
169
170
	/**
171
	 * get_option function.

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

@@ 426-434 (lines=9) @@
423
	 * Initialise Settings for instances.
424
	 * @since 2.6.0
425
	 */
426
	public function init_instance_settings() {
427
		$this->instance_settings = get_option( $this->get_instance_option_key(), null );
428
429
		// If there are no settings defined, use defaults.
430
		if ( ! is_array( $this->instance_settings ) ) {
431
			$form_fields             = $this->get_instance_form_fields();
432
			$this->instance_settings = array_merge( array_fill_keys( array_keys( $form_fields ), '' ), wp_list_pluck( $form_fields, 'default' ) );
433
		}
434
	}
435
436
	/**
437
	 * Processes and saves options.