Code Duplication    Length = 3-3 lines in 4 locations

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

@@ 151-153 (lines=3) @@
148
				return new WP_Error( 'invalid_signature', sprintf( 'The required "%s" parameter is malformed.', str_replace( '_', '-', $required ) ), compact( 'signature_details' ) );
149
			}
150
151
			if ( ! strlen( $$required ) ) {
152
				return new WP_Error( 'invalid_signature', sprintf( 'The required "%s" parameter is missing.', str_replace( '_', '-', $required ) ), compact( 'signature_details' ) );
153
			}
154
		}
155
156
		if ( empty( $body ) ) {
@@ 184-186 (lines=3) @@
181
			}
182
		}
183
184
		if ( ! ctype_digit( "$timestamp" ) || 10 < strlen( $timestamp ) ) { // If Jetpack is around in 275 years, you can blame mdawaffe for the bug.
185
			return new WP_Error( 'invalid_signature', sprintf( 'The required "%s" parameter is malformed.', 'timestamp' ), compact( 'signature_details' ) );
186
		}
187
188
		$local_time = $timestamp - $this->time_diff;
189
		if ( $local_time < time() - 600 || $local_time > time() + 300 ) {
@@ 189-191 (lines=3) @@
186
		}
187
188
		$local_time = $timestamp - $this->time_diff;
189
		if ( $local_time < time() - 600 || $local_time > time() + 300 ) {
190
			return new WP_Error( 'invalid_signature', 'The timestamp is too old.', compact( 'signature_details' ) );
191
		}
192
193
		if ( 12 < strlen( $nonce ) || preg_match( '/[^a-zA-Z0-9]/', $nonce ) ) {
194
			return new WP_Error( 'invalid_signature', sprintf( 'The required "%s" parameter is malformed.', 'nonce' ), compact( 'signature_details' ) );
@@ 193-195 (lines=3) @@
190
			return new WP_Error( 'invalid_signature', 'The timestamp is too old.', compact( 'signature_details' ) );
191
		}
192
193
		if ( 12 < strlen( $nonce ) || preg_match( '/[^a-zA-Z0-9]/', $nonce ) ) {
194
			return new WP_Error( 'invalid_signature', sprintf( 'The required "%s" parameter is malformed.', 'nonce' ), compact( 'signature_details' ) );
195
		}
196
197
		$normalized_request_pieces = array(
198
			$token,