Code Duplication    Length = 18-18 lines in 2 locations

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

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

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

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