Code Duplication    Length = 17-17 lines in 2 locations

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

@@ 190-206 (lines=17) @@
187
	 * @param  mixed  $empty_value
188
	 * @return mixed  The value specified for the option or a default value for the option.
189
	 */
190
	public function get_option( $key, $empty_value = null ) {
191
		if ( empty( $this->settings ) ) {
192
			$this->init_settings();
193
		}
194
195
		// Get option default if unset.
196
		if ( ! isset( $this->settings[ $key ] ) ) {
197
			$form_fields            = $this->get_form_fields();
198
			$this->settings[ $key ] = isset( $form_fields[ $key ] ) ? $this->get_field_default( $form_fields[ $key ] ) : '';
199
		}
200
201
		if ( ! is_null( $empty_value ) && '' === $this->settings[ $key ] ) {
202
			$this->settings[ $key ] = $empty_value;
203
		}
204
205
		return $this->settings[ $key ];
206
	}
207
208
	/**
209
	 * Prefix key for settings.

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

@@ 388-404 (lines=17) @@
385
	 * @param  mixed  $empty_value
386
	 * @return mixed  The value specified for the option or a default value for the option.
387
	 */
388
	public function get_instance_option( $key, $empty_value = null ) {
389
		if ( empty( $this->instance_settings ) ) {
390
			$this->init_instance_settings();
391
		}
392
393
		// Get option default if unset.
394
		if ( ! isset( $this->instance_settings[ $key ] ) ) {
395
			$form_fields                     = $this->get_instance_form_fields();
396
			$this->instance_settings[ $key ] = $this->get_field_default( $form_fields[ $key ] );
397
		}
398
399
		if ( ! is_null( $empty_value ) && '' === $this->instance_settings[ $key ] ) {
400
			$this->instance_settings[ $key ] = $empty_value;
401
		}
402
403
		return $this->instance_settings[ $key ];
404
	}
405
406
	/**
407
	 * Get settings fields for instances of this shipping method (within zones).