Code Duplication    Length = 18-18 lines in 2 locations

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

@@ 116-133 (lines=18) @@
113
		$callable_checksums = (array) get_option( $this->get_checksum_option_name(), array() );
114
115
		// only send the callables that have changed
116
		foreach ( $callables as $name => $value ) {
117
			$checksum = $this->get_check_sum( $value );
118
			// explicitly not using Identical comparison as get_option returns a string
119
			if ( ! $this->still_valid_checksum( $callable_checksums, $name, $checksum ) && ! is_null( $value ) ) {
120
				/**
121
				 * Tells the client to sync a callable (aka function) to the server
122
				 *
123
				 * @since 4.2.0
124
				 *
125
				 * @param string The name of the callable
126
				 * @param mixed The value of the callable
127
				 */
128
				do_action( 'jetpack_sync_callable', $name, $value );
129
				$callable_checksums[ $name ] = $checksum;
130
			} else {
131
				$callable_checksums[ $name ] = $checksum;
132
			}
133
		}
134
		update_option( $this->get_checksum_option_name(), $callable_checksums );
135
	}
136

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

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