Code Duplication    Length = 3-3 lines in 4 locations

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

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