Code Duplication    Length = 17-20 lines in 2 locations

packages/options/src/Manager.php 1 location

@@ 254-270 (lines=17) @@
251
	 *
252
	 * @return mixed Option value, or null if option is not found and default is not specified.
253
	 */
254
	function get_raw_option( $name, $default = null ) {
255
		if ( $this->bypass_raw_option( $name ) ) {
256
			return get_option( $name, $default );
257
		}
258
		global $wpdb;
259
		$value = $wpdb->get_var(
260
			$wpdb->prepare(
261
				"SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1",
262
				$name
263
			)
264
		);
265
		$value = maybe_unserialize( $value );
266
		if ( $value === null && $default !== null ) {
267
			return $default;
268
		}
269
		return $value;
270
	}
271
	/**
272
	 * This function checks for a constant that, if present, will disable direct DB queries Jetpack uses to manage certain options and force Jetpack to always use Options API instead.
273
	 * Options can be selectively managed via a blacklist by filtering option names via the jetpack_disabled_raw_option filter.

class.jetpack-options.php 1 location

@@ 452-471 (lines=20) @@
449
	 *
450
	 * @return mixed Option value, or null if option is not found and default is not specified.
451
	 */
452
	static function get_raw_option( $name, $default = null ) {
453
		if ( self::bypass_raw_option( $name ) ) {
454
			return get_option( $name, $default );
455
		}
456
457
		global $wpdb;
458
		$value = $wpdb->get_var(
459
			$wpdb->prepare(
460
				"SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1",
461
				$name
462
			)
463
		);
464
		$value = maybe_unserialize( $value );
465
466
		if ( $value === null && $default !== null ) {
467
			return $default;
468
		}
469
470
		return $value;
471
	}
472
473
	/**
474
	 * This function checks for a constant that, if present, will disable direct DB queries Jetpack uses to manage certain options and force Jetpack to always use Options API instead.