Code Duplication    Length = 17-17 lines in 2 locations

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).

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

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