Code Duplication    Length = 3-3 lines in 4 locations

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

@@ 184-186 (lines=3) @@
181
				return new WP_Error( 'invalid_signature', sprintf( 'The required "%s" parameter is malformed.', str_replace( '_', '-', $required ) ), compact( 'signature_details' ) );
182
			}
183
184
			if ( ! strlen( $$required ) ) {
185
				return new WP_Error( 'invalid_signature', sprintf( 'The required "%s" parameter is missing.', str_replace( '_', '-', $required ) ), compact( 'signature_details' ) );
186
			}
187
		}
188
189
		if ( empty( $body ) ) {
@@ 217-219 (lines=3) @@
214
			}
215
		}
216
217
		if ( ! ctype_digit( "$timestamp" ) || 10 < strlen( $timestamp ) ) { // If Jetpack is around in 275 years, you can blame mdawaffe for the bug.
218
			return new WP_Error( 'invalid_signature', sprintf( 'The required "%s" parameter is malformed.', 'timestamp' ), compact( 'signature_details' ) );
219
		}
220
221
		$local_time = $timestamp - $this->time_diff;
222
		if ( $local_time < time() - 600 || $local_time > time() + 300 ) {
@@ 222-224 (lines=3) @@
219
		}
220
221
		$local_time = $timestamp - $this->time_diff;
222
		if ( $local_time < time() - 600 || $local_time > time() + 300 ) {
223
			return new WP_Error( 'invalid_signature', 'The timestamp is too old.', compact( 'signature_details' ) );
224
		}
225
226
		if ( 12 < strlen( $nonce ) || preg_match( '/[^a-zA-Z0-9]/', $nonce ) ) {
227
			return new WP_Error( 'invalid_signature', sprintf( 'The required "%s" parameter is malformed.', 'nonce' ), compact( 'signature_details' ) );
@@ 226-228 (lines=3) @@
223
			return new WP_Error( 'invalid_signature', 'The timestamp is too old.', compact( 'signature_details' ) );
224
		}
225
226
		if ( 12 < strlen( $nonce ) || preg_match( '/[^a-zA-Z0-9]/', $nonce ) ) {
227
			return new WP_Error( 'invalid_signature', sprintf( 'The required "%s" parameter is malformed.', 'nonce' ), compact( 'signature_details' ) );
228
		}
229
230
		$normalized_request_pieces = array(
231
			$token,