Code Duplication    Length = 18-18 lines in 2 locations

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

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

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