Code Duplication    Length = 18-18 lines in 2 locations

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

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

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

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