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

@@ 453-472 (lines=20) @@
450
	 *
451
	 * @return mixed Option value, or null if option is not found and default is not specified.
452
	 */
453
	static function get_raw_option( $name, $default = null ) {
454
		if ( self::bypass_raw_option( $name ) ) {
455
			return get_option( $name, $default );
456
		}
457
458
		global $wpdb;
459
		$value = $wpdb->get_var(
460
			$wpdb->prepare(
461
				"SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1",
462
				$name
463
			)
464
		);
465
		$value = maybe_unserialize( $value );
466
467
		if ( $value === null && $default !== null ) {
468
			return $default;
469
		}
470
471
		return $value;
472
	}
473
474
	/**
475
	 * 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.