Code Duplication    Length = 18-18 lines in 2 locations

sync/class.jetpack-sync-module-constants.php 1 location

@@ 77-94 (lines=18) @@
74
75
		$constants_checksums = (array) get_option( self::CONSTANTS_CHECKSUM_OPTION_NAME, array() );
76
77
		foreach ( $constants as $name => $value ) {
78
			$checksum = $this->get_check_sum( $value );
79
			// explicitly not using Identical comparison as get_option returns a string
80
			if ( ! $this->still_valid_checksum( $constants_checksums, $name, $checksum ) && ! is_null( $value ) ) {
81
				/**
82
				 * Tells the client to sync a constant to the server
83
				 *
84
				 * @since 4.2.0
85
				 *
86
				 * @param string The name of the constant
87
				 * @param mixed The value of the constant
88
				 */
89
				do_action( 'jetpack_sync_constant', $name, $value );
90
				$constants_checksums[ $name ] = $checksum;
91
			} else {
92
				$constants_checksums[ $name ] = $checksum;
93
			}
94
		}
95
		update_option( self::CONSTANTS_CHECKSUM_OPTION_NAME, $constants_checksums );
96
	}
97

sync/class.jetpack-sync-module-callables.php 1 location

@@ 233-250 (lines=18) @@
230
		$callable_checksums = (array) Jetpack_Options::get_raw_option( self::CALLABLES_CHECKSUM_OPTION_NAME, array() );
231
232
		// only send the callables that have changed
233
		foreach ( $callables as $name => $value ) {
234
			$checksum = $this->get_check_sum( $value );
235
			// explicitly not using Identical comparison as get_option returns a string
236
			if ( ! is_null( $value ) && $this->should_send_callable( $callable_checksums, $name, $checksum ) ) {
237
				/**
238
				 * Tells the client to sync a callable (aka function) to the server
239
				 *
240
				 * @since 4.2.0
241
				 *
242
				 * @param string The name of the callable
243
				 * @param mixed The value of the callable
244
				 */
245
				do_action( 'jetpack_sync_callable', $name, $value );
246
				$callable_checksums[ $name ] = $checksum;
247
			} else {
248
				$callable_checksums[ $name ] = $checksum;
249
			}
250
		}
251
		Jetpack_Options::update_raw_option( self::CALLABLES_CHECKSUM_OPTION_NAME, $callable_checksums );
252
	}
253