Code Duplication    Length = 3-3 lines in 4 locations

packages/connection/legacy/class.jetpack-signature.php 4 locations

@@ 212-214 (lines=3) @@
209
				return new WP_Error( 'invalid_signature', sprintf( 'The required "%s" parameter is malformed.', str_replace( '_', '-', $required ) ), compact( 'signature_details' ) );
210
			}
211
212
			if ( ! strlen( $$required ) ) {
213
				return new WP_Error( 'invalid_signature', sprintf( 'The required "%s" parameter is missing.', str_replace( '_', '-', $required ) ), compact( 'signature_details' ) );
214
			}
215
		}
216
217
		if ( empty( $body ) ) {
@@ 246-248 (lines=3) @@
243
			}
244
		}
245
246
		if ( ! ctype_digit( "$timestamp" ) || 10 < strlen( $timestamp ) ) { // If Jetpack is around in 275 years, you can blame mdawaffe for the bug.
247
			return new WP_Error( 'invalid_signature', sprintf( 'The required "%s" parameter is malformed.', 'timestamp' ), compact( 'signature_details' ) );
248
		}
249
250
		$local_time = $timestamp - $this->time_diff;
251
		if ( $local_time < time() - 600 || $local_time > time() + 300 ) {
@@ 251-253 (lines=3) @@
248
		}
249
250
		$local_time = $timestamp - $this->time_diff;
251
		if ( $local_time < time() - 600 || $local_time > time() + 300 ) {
252
			return new WP_Error( 'invalid_signature', 'The timestamp is too old.', compact( 'signature_details' ) );
253
		}
254
255
		if ( 12 < strlen( $nonce ) || preg_match( '/[^a-zA-Z0-9]/', $nonce ) ) {
256
			return new WP_Error( 'invalid_signature', sprintf( 'The required "%s" parameter is malformed.', 'nonce' ), compact( 'signature_details' ) );
@@ 255-257 (lines=3) @@
252
			return new WP_Error( 'invalid_signature', 'The timestamp is too old.', compact( 'signature_details' ) );
253
		}
254
255
		if ( 12 < strlen( $nonce ) || preg_match( '/[^a-zA-Z0-9]/', $nonce ) ) {
256
			return new WP_Error( 'invalid_signature', sprintf( 'The required "%s" parameter is malformed.', 'nonce' ), compact( 'signature_details' ) );
257
		}
258
259
		$normalized_request_pieces = array(
260
			$token,