Code Duplication    Length = 9-9 lines in 2 locations

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

@@ 171-179 (lines=9) @@
168
	 * @since 1.0.0
169
	 * @uses get_option(), add_option()
170
	 */
171
	public function init_settings() {
172
		$this->settings = get_option( $this->get_option_key(), null );
173
174
		// If there are no settings defined, use defaults.
175
		if ( ! is_array( $this->settings ) ) {
176
			$form_fields    = $this->get_form_fields();
177
			$this->settings = array_merge( array_fill_keys( array_keys( $form_fields ), '' ), wp_list_pluck( $form_fields, 'default' ) );
178
		}
179
	}
180
181
	/**
182
	 * get_option function.

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

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